Initial revision
[TestXSLT.git] / libxml2 / include / libxml / c14n.h
1 /*
2  * "Canonical XML" implementation 
3  * http://www.w3.org/TR/xml-c14n
4  * 
5  * "Exclusive XML Canonicalization" implementation
6  * http://www.w3.org/TR/xml-exc-c14n
7  
8  * See Copyright for the status of this software.
9  * 
10  * Author: Aleksey Sanin <aleksey@aleksey.com>
11  */
12 #ifndef __XML_C14N_H__
13 #define __XML_C14N_H__    
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */ 
18
19 #include <libxml/tree.h>
20 #include <libxml/xpath.h> 
21
22 /*
23  * XML Canonicazation
24  * http://www.w3.org/TR/xml-c14n
25  *
26  * Exclusive XML Canonicazation
27  * http://www.w3.org/TR/xml-exc-c14n
28  *
29  * Canonical form of an XML document could be created if and only if
30  *  a) default attributes (if any) are added to all nodes
31  *  b) all character and parsed entity references are resolved
32  * In order to achive this in libxml2 the document MUST be loaded with 
33  * following global setings:
34  *    
35  *    xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
36  *    xmlSubstituteEntitiesDefault(1);
37  *
38  * or corresponding parser context setting:
39  *    xmlParserCtxtPtr ctxt;
40  *    
41  *    ... 
42  *    ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
43  *    ctxt->replaceEntities = 1;
44  *    ...
45  */
46
47
48 int             xmlC14NDocSaveTo        (xmlDocPtr doc,
49                                          xmlNodeSetPtr nodes,
50                                          int exclusive,
51                                          xmlChar **inclusive_ns_prefixes,
52                                          int with_comments, 
53                                          xmlOutputBufferPtr buf);
54
55 int             xmlC14NDocDumpMemory    (xmlDocPtr doc,
56                                          xmlNodeSetPtr nodes,
57                                          int exclusive,
58                                          xmlChar **inclusive_ns_prefixes,
59                                          int with_comments, 
60                                          xmlChar **doc_txt_ptr);
61
62 int             xmlC14NDocSave          (xmlDocPtr doc,
63                                          xmlNodeSetPtr nodes,
64                                          int exclusive,
65                                          xmlChar **inclusive_ns_prefixes,
66                                          int with_comments, 
67                                          const char* filename,
68                                          int compression);
69
70
71 /**
72  * This is the core C14N function
73  */
74 typedef int (*xmlC14NIsVisibleCallback) (void* user_data, 
75                                          xmlNodePtr node,
76                                          xmlNodePtr parent);
77
78 int             xmlC14NExecute          (xmlDocPtr doc,
79                                          xmlC14NIsVisibleCallback is_visible_callback,
80                                          void* user_data,                                
81                                          int exclusive,
82                                          xmlChar **inclusive_ns_prefixes,
83                                          int with_comments, 
84                                          xmlOutputBufferPtr buf);
85
86 #ifdef __cplusplus
87 }
88 #endif /* __cplusplus */
89
90 #endif /* __XML_C14N_H__ */
91