Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Summary: the XML document serializer |
| 3 | * Description: API to save document or subtree of document |
| 4 | * |
| 5 | * Copy: See Copyright for the status of this software. |
| 6 | * |
| 7 | * Author: Daniel Veillard |
| 8 | */ |
| 9 | |
| 10 | #ifndef __XML_XMLSAVE_H__ |
| 11 | #define __XML_XMLSAVE_H__ |
| 12 | |
| 13 | #include <libxml/xmlversion.h> |
| 14 | #include <libxml/tree.h> |
Daniel Veillard | 3995bc3 | 2004-05-15 18:57:31 +0000 | [diff] [blame] | 15 | #include <libxml/encoding.h> |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 16 | #include <libxml/xmlIO.h> |
| 17 | |
Daniel Veillard | 2156d43 | 2004-03-04 15:59:36 +0000 | [diff] [blame] | 18 | #ifdef LIBXML_OUTPUT_ENABLED |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
Daniel Veillard | 6fc5db0 | 2005-01-16 00:05:58 +0000 | [diff] [blame] | 23 | /** |
| 24 | * xmlSaveOption: |
| 25 | * |
| 26 | * This is the set of XML save options that can be passed down |
| 27 | * to the xmlSaveToFd() and similar calls. |
| 28 | */ |
| 29 | typedef enum { |
Daniel Veillard | 100e180 | 2005-08-08 14:44:11 +0000 | [diff] [blame] | 30 | XML_SAVE_FORMAT = 1<<0, /* format save output */ |
Rob Richards | 2ce51c0 | 2005-09-12 12:16:35 +0000 | [diff] [blame] | 31 | XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ |
Daniel Veillard | 33b20b7 | 2005-09-12 21:43:20 +0000 | [diff] [blame] | 32 | XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ |
Daniel Veillard | 856d928 | 2008-09-25 14:31:40 +0000 | [diff] [blame] | 33 | XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ |
| 34 | XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ |
| 35 | XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ |
Adam Spragg | d2e6231 | 2010-11-03 15:33:40 +0100 | [diff] [blame] | 36 | XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ |
| 37 | XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ |
Daniel Veillard | 6fc5db0 | 2005-01-16 00:05:58 +0000 | [diff] [blame] | 38 | } xmlSaveOption; |
| 39 | |
| 40 | |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 41 | typedef struct _xmlSaveCtxt xmlSaveCtxt; |
| 42 | typedef xmlSaveCtxt *xmlSaveCtxtPtr; |
| 43 | |
| 44 | XMLPUBFUN xmlSaveCtxtPtr XMLCALL |
| 45 | xmlSaveToFd (int fd, |
| 46 | const char *encoding, |
| 47 | int options); |
| 48 | XMLPUBFUN xmlSaveCtxtPtr XMLCALL |
| 49 | xmlSaveToFilename (const char *filename, |
| 50 | const char *encoding, |
| 51 | int options); |
Daniel Veillard | a235132 | 2004-06-27 12:08:10 +0000 | [diff] [blame] | 52 | |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 53 | XMLPUBFUN xmlSaveCtxtPtr XMLCALL |
| 54 | xmlSaveToBuffer (xmlBufferPtr buffer, |
| 55 | const char *encoding, |
| 56 | int options); |
Daniel Veillard | 9a00fd2 | 2005-11-09 08:56:26 +0000 | [diff] [blame] | 57 | |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 58 | XMLPUBFUN xmlSaveCtxtPtr XMLCALL |
| 59 | xmlSaveToIO (xmlOutputWriteCallback iowrite, |
| 60 | xmlOutputCloseCallback ioclose, |
| 61 | void *ioctx, |
| 62 | const char *encoding, |
| 63 | int options); |
| 64 | |
| 65 | XMLPUBFUN long XMLCALL |
| 66 | xmlSaveDoc (xmlSaveCtxtPtr ctxt, |
| 67 | xmlDocPtr doc); |
| 68 | XMLPUBFUN long XMLCALL |
| 69 | xmlSaveTree (xmlSaveCtxtPtr ctxt, |
| 70 | xmlNodePtr node); |
| 71 | |
| 72 | XMLPUBFUN int XMLCALL |
| 73 | xmlSaveFlush (xmlSaveCtxtPtr ctxt); |
| 74 | XMLPUBFUN int XMLCALL |
| 75 | xmlSaveClose (xmlSaveCtxtPtr ctxt); |
Daniel Veillard | 3995bc3 | 2004-05-15 18:57:31 +0000 | [diff] [blame] | 76 | XMLPUBFUN int XMLCALL |
| 77 | xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, |
| 78 | xmlCharEncodingOutputFunc escape); |
| 79 | XMLPUBFUN int XMLCALL |
| 80 | xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, |
| 81 | xmlCharEncodingOutputFunc escape); |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 82 | #ifdef __cplusplus |
| 83 | } |
| 84 | #endif |
Daniel Veillard | 2156d43 | 2004-03-04 15:59:36 +0000 | [diff] [blame] | 85 | #endif /* LIBXML_OUTPUT_ENABLED */ |
Daniel Veillard | 1a8741c | 2004-03-04 13:40:59 +0000 | [diff] [blame] | 86 | #endif /* __XML_XMLSAVE_H__ */ |
| 87 | |
| 88 | |