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> 15 #include <libxml/encoding.h> 16 #include <libxml/xmlIO.h> 17 18 #ifdef LIBXML_OUTPUT_ENABLED 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 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 { 30 XML_SAVE_FORMAT = 1<<0, /* format save output */ 31 XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ 32 XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ 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 */ 36 XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ 37 XML_SAVE_WSNONSIG = 1<<7, /* format with non-significant whitespace */ 38 /* Available since 2.14.0 */ 39 XML_SAVE_EMPTY = 1<<8, /* force empty tags, overriding global */ 40 XML_SAVE_NO_INDENT = 1<<9, /* disable indenting */ 41 XML_SAVE_INDENT = 1<<10 /* force indenting, overriding global */ 42 } xmlSaveOption; 43 44 45 typedef struct _xmlSaveCtxt xmlSaveCtxt; 46 typedef xmlSaveCtxt *xmlSaveCtxtPtr; 47 48 XMLPUBFUN xmlSaveCtxtPtr 49 xmlSaveToFd (int fd, 50 const char *encoding, 51 int options); 52 XMLPUBFUN xmlSaveCtxtPtr 53 xmlSaveToFilename (const char *filename, 54 const char *encoding, 55 int options); 56 57 XMLPUBFUN xmlSaveCtxtPtr 58 xmlSaveToBuffer (xmlBufferPtr buffer, 59 const char *encoding, 60 int options); 61 62 XMLPUBFUN xmlSaveCtxtPtr 63 xmlSaveToIO (xmlOutputWriteCallback iowrite, 64 xmlOutputCloseCallback ioclose, 65 void *ioctx, 66 const char *encoding, 67 int options); 68 69 XMLPUBFUN long 70 xmlSaveDoc (xmlSaveCtxtPtr ctxt, 71 xmlDocPtr doc); 72 XMLPUBFUN long 73 xmlSaveTree (xmlSaveCtxtPtr ctxt, 74 xmlNodePtr node); 75 76 XMLPUBFUN int 77 xmlSaveFlush (xmlSaveCtxtPtr ctxt); 78 XMLPUBFUN int 79 xmlSaveClose (xmlSaveCtxtPtr ctxt); 80 XMLPUBFUN int 81 xmlSaveFinish (xmlSaveCtxtPtr ctxt); 82 XMLPUBFUN int 83 xmlSaveSetIndentString (xmlSaveCtxtPtr ctxt, 84 const char *indent); 85 XML_DEPRECATED 86 XMLPUBFUN int 87 xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, 88 xmlCharEncodingOutputFunc escape); 89 XML_DEPRECATED 90 XMLPUBFUN int 91 xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, 92 xmlCharEncodingOutputFunc escape); 93 94 XML_DEPRECATED 95 XMLPUBFUN int 96 xmlThrDefIndentTreeOutput(int v); 97 XML_DEPRECATED 98 XMLPUBFUN const char * 99 xmlThrDefTreeIndentString(const char * v); 100 XML_DEPRECATED 101 XMLPUBFUN int 102 xmlThrDefSaveNoEmptyTags(int v); 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* LIBXML_OUTPUT_ENABLED */ 109 #endif /* __XML_XMLSAVE_H__ */ 110 111 112