Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:41:48

0001 /*
0002  * Summary: Provide Canonical XML and Exclusive XML Canonicalization
0003  * Description: the c14n modules provides a
0004  *
0005  * "Canonical XML" implementation
0006  * http://www.w3.org/TR/xml-c14n
0007  *
0008  * and an
0009  *
0010  * "Exclusive XML Canonicalization" implementation
0011  * http://www.w3.org/TR/xml-exc-c14n
0012 
0013  * Copy: See Copyright for the status of this software.
0014  *
0015  * Author: Aleksey Sanin <aleksey@aleksey.com>
0016  */
0017 #ifndef __XML_C14N_H__
0018 #define __XML_C14N_H__
0019 
0020 #include <libxml/xmlversion.h>
0021 
0022 #ifdef LIBXML_C14N_ENABLED
0023 
0024 #include <libxml/tree.h>
0025 #include <libxml/xpath.h>
0026 
0027 #ifdef __cplusplus
0028 extern "C" {
0029 #endif /* __cplusplus */
0030 
0031 /*
0032  * XML Canonicalization
0033  * http://www.w3.org/TR/xml-c14n
0034  *
0035  * Exclusive XML Canonicalization
0036  * http://www.w3.org/TR/xml-exc-c14n
0037  *
0038  * Canonical form of an XML document could be created if and only if
0039  *  a) default attributes (if any) are added to all nodes
0040  *  b) all character and parsed entity references are resolved
0041  * In order to achieve this in libxml2 the document MUST be loaded with
0042  * following options: XML_PARSE_DTDATTR | XML_PARSE_NOENT
0043  */
0044 
0045 /*
0046  * xmlC14NMode:
0047  *
0048  * Predefined values for C14N modes
0049  *
0050  */
0051 typedef enum {
0052     XML_C14N_1_0            = 0,    /* Original C14N 1.0 spec */
0053     XML_C14N_EXCLUSIVE_1_0  = 1,    /* Exclusive C14N 1.0 spec */
0054     XML_C14N_1_1            = 2     /* C14N 1.1 spec */
0055 } xmlC14NMode;
0056 
0057 XMLPUBFUN int
0058         xmlC14NDocSaveTo    (xmlDocPtr doc,
0059                      xmlNodeSetPtr nodes,
0060                      int mode, /* a xmlC14NMode */
0061                      xmlChar **inclusive_ns_prefixes,
0062                      int with_comments,
0063                      xmlOutputBufferPtr buf);
0064 
0065 XMLPUBFUN int
0066         xmlC14NDocDumpMemory    (xmlDocPtr doc,
0067                      xmlNodeSetPtr nodes,
0068                      int mode, /* a xmlC14NMode */
0069                      xmlChar **inclusive_ns_prefixes,
0070                      int with_comments,
0071                      xmlChar **doc_txt_ptr);
0072 
0073 XMLPUBFUN int
0074         xmlC14NDocSave      (xmlDocPtr doc,
0075                      xmlNodeSetPtr nodes,
0076                      int mode, /* a xmlC14NMode */
0077                      xmlChar **inclusive_ns_prefixes,
0078                      int with_comments,
0079                      const char* filename,
0080                      int compression);
0081 
0082 
0083 /**
0084  * This is the core C14N function
0085  */
0086 /**
0087  * xmlC14NIsVisibleCallback:
0088  * @user_data: user data
0089  * @node: the current node
0090  * @parent: the parent node
0091  *
0092  * Signature for a C14N callback on visible nodes
0093  *
0094  * Returns 1 if the node should be included
0095  */
0096 typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
0097                      xmlNodePtr node,
0098                      xmlNodePtr parent);
0099 
0100 XMLPUBFUN int
0101         xmlC14NExecute      (xmlDocPtr doc,
0102                      xmlC14NIsVisibleCallback is_visible_callback,
0103                      void* user_data,
0104                      int mode, /* a xmlC14NMode */
0105                      xmlChar **inclusive_ns_prefixes,
0106                      int with_comments,
0107                      xmlOutputBufferPtr buf);
0108 
0109 #ifdef __cplusplus
0110 }
0111 #endif /* __cplusplus */
0112 
0113 #endif /* LIBXML_C14N_ENABLED */
0114 #endif /* __XML_C14N_H__ */
0115