Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 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__ |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame^] | 14 | #ifdef LIBXML_OUTPUT_ENABLED |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif /* __cplusplus */ |
| 19 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 20 | #include <libxml/xmlversion.h> |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 21 | #include <libxml/tree.h> |
| 22 | #include <libxml/xpath.h> |
| 23 | |
| 24 | /* |
| 25 | * XML Canonicazation |
| 26 | * http://www.w3.org/TR/xml-c14n |
| 27 | * |
| 28 | * Exclusive XML Canonicazation |
| 29 | * http://www.w3.org/TR/xml-exc-c14n |
| 30 | * |
| 31 | * Canonical form of an XML document could be created if and only if |
| 32 | * a) default attributes (if any) are added to all nodes |
| 33 | * b) all character and parsed entity references are resolved |
| 34 | * In order to achive this in libxml2 the document MUST be loaded with |
| 35 | * following global setings: |
| 36 | * |
| 37 | * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; |
| 38 | * xmlSubstituteEntitiesDefault(1); |
| 39 | * |
| 40 | * or corresponding parser context setting: |
| 41 | * xmlParserCtxtPtr ctxt; |
| 42 | * |
| 43 | * ... |
| 44 | * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; |
| 45 | * ctxt->replaceEntities = 1; |
| 46 | * ... |
| 47 | */ |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 48 | |
| 49 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 50 | XMLPUBFUN int XMLCALL |
| 51 | xmlC14NDocSaveTo (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 52 | xmlNodeSetPtr nodes, |
| 53 | int exclusive, |
| 54 | xmlChar **inclusive_ns_prefixes, |
| 55 | int with_comments, |
| 56 | xmlOutputBufferPtr buf); |
| 57 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 58 | XMLPUBFUN int XMLCALL |
| 59 | xmlC14NDocDumpMemory (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 60 | xmlNodeSetPtr nodes, |
| 61 | int exclusive, |
| 62 | xmlChar **inclusive_ns_prefixes, |
| 63 | int with_comments, |
| 64 | xmlChar **doc_txt_ptr); |
| 65 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 66 | XMLPUBFUN int XMLCALL |
| 67 | xmlC14NDocSave (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 68 | xmlNodeSetPtr nodes, |
| 69 | int exclusive, |
| 70 | xmlChar **inclusive_ns_prefixes, |
| 71 | int with_comments, |
| 72 | const char* filename, |
| 73 | int compression); |
| 74 | |
| 75 | |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 76 | /** |
| 77 | * This is the core C14N function |
| 78 | */ |
| 79 | typedef int (*xmlC14NIsVisibleCallback) (void* user_data, |
| 80 | xmlNodePtr node, |
| 81 | xmlNodePtr parent); |
| 82 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 83 | XMLPUBFUN int XMLCALL |
| 84 | xmlC14NExecute (xmlDocPtr doc, |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 85 | xmlC14NIsVisibleCallback is_visible_callback, |
| 86 | void* user_data, |
| 87 | int exclusive, |
| 88 | xmlChar **inclusive_ns_prefixes, |
| 89 | int with_comments, |
| 90 | xmlOutputBufferPtr buf); |
| 91 | |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 92 | #ifdef __cplusplus |
| 93 | } |
| 94 | #endif /* __cplusplus */ |
| 95 | |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame^] | 96 | #endif /* LIBXML_OUTPUT_ENABLED */ |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 97 | #endif /* __XML_C14N_H__ */ |
| 98 | |