2 * Summary: Provide Canonical XML and Exclusive XML Canonicalization
3 * Description: the c14n modules provides a
5 * "Canonical XML" implementation
6 * http://www.w3.org/TR/xml-c14n
10 * "Exclusive XML Canonicalization" implementation
11 * http://www.w3.org/TR/xml-exc-c14n
13 * Copy: See Copyright for the status of this software.
15 * Author: Aleksey Sanin <aleksey@aleksey.com>
17 #ifndef __XML_C14N_H__
18 #define __XML_C14N_H__
19 #ifdef LIBXML_C14N_ENABLED
20 #ifdef LIBXML_OUTPUT_ENABLED
24 #endif /* __cplusplus */
26 #include <libxml/xmlversion.h>
27 #include <libxml/tree.h>
28 #include <libxml/xpath.h>
32 * http://www.w3.org/TR/xml-c14n
34 * Exclusive XML Canonicazation
35 * http://www.w3.org/TR/xml-exc-c14n
37 * Canonical form of an XML document could be created if and only if
38 * a) default attributes (if any) are added to all nodes
39 * b) all character and parsed entity references are resolved
40 * In order to achive this in libxml2 the document MUST be loaded with
41 * following global setings:
43 * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
44 * xmlSubstituteEntitiesDefault(1);
46 * or corresponding parser context setting:
47 * xmlParserCtxtPtr ctxt;
50 * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
51 * ctxt->replaceEntities = 1;
58 * Predefined values for C14N modes
62 XML_C14N_1_0
= 0, /* Origianal C14N 1.0 spec */
63 XML_C14N_EXCLUSIVE_1_0
= 1, /* Exclusive C14N 1.0 spec */
64 XML_C14N_1_1
= 2 /* C14N 1.1 spec */
68 xmlC14NDocSaveTo (xmlDocPtr doc
,
70 int mode
, /* a xmlC14NMode */
71 xmlChar
**inclusive_ns_prefixes
,
73 xmlOutputBufferPtr buf
);
76 xmlC14NDocDumpMemory (xmlDocPtr doc
,
78 int mode
, /* a xmlC14NMode */
79 xmlChar
**inclusive_ns_prefixes
,
81 xmlChar
**doc_txt_ptr
);
84 xmlC14NDocSave (xmlDocPtr doc
,
86 int mode
, /* a xmlC14NMode */
87 xmlChar
**inclusive_ns_prefixes
,
94 * This is the core C14N function
97 * xmlC14NIsVisibleCallback:
98 * @user_data: user data
99 * @node: the curent node
100 * @parent: the parent node
102 * Signature for a C14N callback on visible nodes
104 * Returns 1 if the node should be included
106 typedef int (*xmlC14NIsVisibleCallback
) (void* user_data
,
110 XMLPUBFUN
int XMLCALL
111 xmlC14NExecute (xmlDocPtr doc
,
112 xmlC14NIsVisibleCallback is_visible_callback
,
114 int mode
, /* a xmlC14NMode */
115 xmlChar
**inclusive_ns_prefixes
,
117 xmlOutputBufferPtr buf
);
121 #endif /* __cplusplus */
123 #endif /* LIBXML_OUTPUT_ENABLED */
124 #endif /* LIBXML_C14N_ENABLED */
125 #endif /* __XML_C14N_H__ */