xml/libxml2libs/inc/libxml2/libxml2_xmlsave.h
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     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  * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
       
     9  */
       
    10 
       
    11 /** @file
       
    12 @publishedAll
       
    13 @released
       
    14 */
       
    15 
       
    16 #ifndef XML_XMLSAVE_H
       
    17 #define XML_XMLSAVE_H
       
    18 
       
    19 #include <stdapis/libxml2/libxml2_xmlio.h>
       
    20 
       
    21 #ifdef LIBXML_OUTPUT_ENABLED
       
    22 #ifdef __cplusplus
       
    23 extern "C" {
       
    24 #endif
       
    25 
       
    26 #define MAX_INDENT 60
       
    27 
       
    28 #ifdef XMLENGINE_NODEFILTER
       
    29 
       
    30 /**
       
    31 Pointer to implementation of interface NodeFilter (as introduced in DOM Level 2)
       
    32 
       
    33 @param aNode   Node to test
       
    34 @return
       
    35     1  =  KFilterAccept  - use node
       
    36     2  =  KFilterReject  - do not use node but proceed with child nodes
       
    37     3  =  KFilterSkip    - skip node and its subtree
       
    38     4  =  KFilterSkipElementContents - [non-standard option]
       
    39 */
       
    40 typedef int (XMLCALL *xmlNodeFilterFunc)(xmlNodePtr aNode);
       
    41 typedef int (XMLCALL *xmlNodeFilterProxyFunc)(void* fn, xmlNodePtr aNode);
       
    42 
       
    43 // Constansts for results that are returned by callbacks of node filter during serialization
       
    44 extern const int KFilterAccept;
       
    45 extern const int KFilterReject;
       
    46 extern const int KFilterSkip;
       
    47 extern const int KFilterSkipElementContents;
       
    48 
       
    49 typedef struct _xmlNodeFilterData xmlNodeFilterData;
       
    50 
       
    51 /**
       
    52  * xmlSaveTextNodeCallback:
       
    53  * @param context an Save context
       
    54  * @param aNode node to be serialized
       
    55  *
       
    56  * Callback used in serializing text nodes
       
    57  *
       
    58  * Returns NULL or pointer to string that replaces binary data
       
    59  */
       
    60 typedef unsigned char* (*xmlSaveTextNodeCallback) (void * context, xmlNodePtr aNode, int* written);
       
    61 
       
    62 struct _xmlNodeFilterData{
       
    63       void* fn;
       
    64       xmlNodeFilterProxyFunc proxyFn;
       
    65 };
       
    66 #endif
       
    67 
       
    68 typedef struct _xmlSaveCtxt xmlSaveCtxt;
       
    69 typedef xmlSaveCtxt *xmlSaveCtxtPtr;
       
    70 struct _xmlSaveCtxt {
       
    71     void *_private;
       
    72     int type;
       
    73     int fd;
       
    74     const xmlChar *filename;
       
    75     const xmlChar *encoding;
       
    76     xmlCharEncodingHandlerPtr handler;
       
    77     xmlOutputBufferPtr buf;
       
    78     xmlDocPtr doc;
       
    79     int options;
       
    80     int level;
       
    81     int format;
       
    82     
       
    83     char indent[MAX_INDENT + 1];    /* array for indenting output */
       
    84     int indent_nr;
       
    85     int indent_size;
       
    86     xmlCharEncodingOutputFunc escape;   /* used for element content */
       
    87     xmlCharEncodingOutputFunc escapeAttr;/* used for attribute content */
       
    88     xmlSaveTextNodeCallback textNodeCallback;
       
    89     void * context; /* save context */
       
    90 #ifdef XMLENGINE_NODEFILTER
       
    91     xmlNodeFilterData* nodeFilter;
       
    92 #endif
       
    93 };
       
    94 
       
    95 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
       
    96         xmlSaveToFd(
       
    97                     int fd,
       
    98                     const char *encoding,
       
    99                     int options);
       
   100 
       
   101 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
       
   102         xmlSaveToFilename(
       
   103                     const char *filename,
       
   104                     const char *encoding,
       
   105                     int options);
       
   106 
       
   107 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
       
   108         xmlSaveToBuffer(
       
   109                     xmlBufferPtr buffer,
       
   110                     const char *encoding,
       
   111                     int options);
       
   112 
       
   113 XMLPUBFUN xmlSaveCtxtPtr XMLCALL
       
   114         xmlSaveToIO(
       
   115                     xmlOutputWriteCallback iowrite,
       
   116                     xmlOutputCloseCallback ioclose,
       
   117                     void *ioctx,
       
   118                     const char *encoding,
       
   119                     int options);
       
   120 
       
   121 XMLPUBFUN long XMLCALL
       
   122         xmlSaveDoc(
       
   123                     xmlSaveCtxtPtr ctxt,
       
   124                     xmlDocPtr doc);
       
   125 
       
   126 XMLPUBFUN long XMLCALL
       
   127         xmlSaveTree(
       
   128                     xmlSaveCtxtPtr ctxt,
       
   129                     xmlNodePtr node);
       
   130 // XMLENGINE: were made exported
       
   131 void xmlNsListDumpOutput(
       
   132                     xmlOutputBufferPtr buf,
       
   133                     xmlNsPtr cur);
       
   134 //
       
   135 XMLPUBFUN int XMLCALL
       
   136         xmlSaveFlush(
       
   137                     xmlSaveCtxtPtr ctxt);
       
   138 
       
   139 XMLPUBFUN int XMLCALL
       
   140         xmlSaveClose        (xmlSaveCtxtPtr ctxt);
       
   141 XMLPUBFUN int XMLCALL
       
   142         xmlSaveSetEscape    (xmlSaveCtxtPtr ctxt,
       
   143                      xmlCharEncodingOutputFunc escape);
       
   144 XMLPUBFUN int XMLCALL
       
   145         xmlSaveSetAttrEscape    (xmlSaveCtxtPtr ctxt,
       
   146                      xmlCharEncodingOutputFunc escape);
       
   147 
       
   148 #ifdef __cplusplus
       
   149 }
       
   150 #endif
       
   151 
       
   152 #endif /* LIBXML_OUTPUT_ENABLED */
       
   153 
       
   154 #endif /* XML_XMLSAVE_H */