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 } xmlSaveOption;
  38 
  39 
  40 typedef struct _xmlSaveCtxt xmlSaveCtxt;
  41 typedef xmlSaveCtxt *xmlSaveCtxtPtr;
  42 
  43 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
  44         xmlSaveToFd     (int fd,
  45                      const char *encoding,
  46                      int options);
  47 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
  48         xmlSaveToFilename   (const char *filename,
  49                      const char *encoding,
  50                      int options);
  51 
  52 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
  53         xmlSaveToBuffer     (xmlBufferPtr buffer,
  54                      const char *encoding,
  55                      int options);
  56 
  57 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
  58         xmlSaveToIO     (xmlOutputWriteCallback iowrite,
  59                      xmlOutputCloseCallback ioclose,
  60                      void *ioctx,
  61                      const char *encoding,
  62                      int options);
  63 
  64 XMLPUBFUN long XMLCALL
  65         xmlSaveDoc      (xmlSaveCtxtPtr ctxt,
  66                      xmlDocPtr doc);
  67 XMLPUBFUN long XMLCALL
  68         xmlSaveTree     (xmlSaveCtxtPtr ctxt,
  69                      xmlNodePtr node);
  70 
  71 XMLPUBFUN int XMLCALL
  72         xmlSaveFlush        (xmlSaveCtxtPtr ctxt);
  73 XMLPUBFUN int XMLCALL
  74         xmlSaveClose        (xmlSaveCtxtPtr ctxt);
  75 XMLPUBFUN int XMLCALL
  76         xmlSaveSetEscape    (xmlSaveCtxtPtr ctxt,
  77                      xmlCharEncodingOutputFunc escape);
  78 XMLPUBFUN int XMLCALL
  79         xmlSaveSetAttrEscape    (xmlSaveCtxtPtr ctxt,
  80                      xmlCharEncodingOutputFunc escape);
  81 #ifdef __cplusplus
  82 }
  83 #endif
  84 #endif /* LIBXML_OUTPUT_ENABLED */
  85 #endif /* __XML_XMLSAVE_H__ */
  86 
  87