Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 1 | /* |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 2 | * Summary: Provide Canonical XML and Exclusive XML Canonicalization |
| 3 | * Description: the c14n modules provides a |
| 4 | * |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 5 | * "Canonical XML" implementation |
| 6 | * http://www.w3.org/TR/xml-c14n |
| 7 | * |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 8 | * and an |
| 9 | * |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 10 | * "Exclusive XML Canonicalization" implementation |
| 11 | * http://www.w3.org/TR/xml-exc-c14n |
| 12 | |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 13 | * Copy: See Copyright for the status of this software. |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 14 | * |
| 15 | * Author: Aleksey Sanin <aleksey@aleksey.com> |
| 16 | */ |
| 17 | #ifndef __XML_C14N_H__ |
| 18 | #define __XML_C14N_H__ |
Daniel Veillard | a235132 | 2004-06-27 12:08:10 +0000 | [diff] [blame] | 19 | #ifdef LIBXML_C14N_ENABLED |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame] | 20 | #ifdef LIBXML_OUTPUT_ENABLED |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif /* __cplusplus */ |
| 25 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 26 | #include <libxml/xmlversion.h> |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 27 | #include <libxml/tree.h> |
| 28 | #include <libxml/xpath.h> |
| 29 | |
| 30 | /* |
| 31 | * XML Canonicazation |
| 32 | * http://www.w3.org/TR/xml-c14n |
| 33 | * |
| 34 | * Exclusive XML Canonicazation |
| 35 | * http://www.w3.org/TR/xml-exc-c14n |
| 36 | * |
| 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: |
| 42 | * |
| 43 | * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; |
| 44 | * xmlSubstituteEntitiesDefault(1); |
| 45 | * |
| 46 | * or corresponding parser context setting: |
| 47 | * xmlParserCtxtPtr ctxt; |
| 48 | * |
| 49 | * ... |
| 50 | * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; |
| 51 | * ctxt->replaceEntities = 1; |
| 52 | * ... |
| 53 | */ |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 54 | |
| 55 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 56 | XMLPUBFUN int XMLCALL |
| 57 | xmlC14NDocSaveTo (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 58 | xmlNodeSetPtr nodes, |
| 59 | int exclusive, |
| 60 | xmlChar **inclusive_ns_prefixes, |
| 61 | int with_comments, |
| 62 | xmlOutputBufferPtr buf); |
| 63 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 64 | XMLPUBFUN int XMLCALL |
| 65 | xmlC14NDocDumpMemory (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 66 | xmlNodeSetPtr nodes, |
| 67 | int exclusive, |
| 68 | xmlChar **inclusive_ns_prefixes, |
| 69 | int with_comments, |
| 70 | xmlChar **doc_txt_ptr); |
| 71 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 72 | XMLPUBFUN int XMLCALL |
| 73 | xmlC14NDocSave (xmlDocPtr doc, |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 74 | xmlNodeSetPtr nodes, |
| 75 | int exclusive, |
| 76 | xmlChar **inclusive_ns_prefixes, |
| 77 | int with_comments, |
| 78 | const char* filename, |
| 79 | int compression); |
| 80 | |
| 81 | |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 82 | /** |
| 83 | * This is the core C14N function |
| 84 | */ |
| 85 | typedef int (*xmlC14NIsVisibleCallback) (void* user_data, |
| 86 | xmlNodePtr node, |
| 87 | xmlNodePtr parent); |
| 88 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 89 | XMLPUBFUN int XMLCALL |
| 90 | xmlC14NExecute (xmlDocPtr doc, |
Aleksey Sanin | 2c135a1 | 2002-08-01 06:31:50 +0000 | [diff] [blame] | 91 | xmlC14NIsVisibleCallback is_visible_callback, |
| 92 | void* user_data, |
| 93 | int exclusive, |
| 94 | xmlChar **inclusive_ns_prefixes, |
| 95 | int with_comments, |
| 96 | xmlOutputBufferPtr buf); |
| 97 | |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 98 | #ifdef __cplusplus |
| 99 | } |
| 100 | #endif /* __cplusplus */ |
| 101 | |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame] | 102 | #endif /* LIBXML_OUTPUT_ENABLED */ |
Daniel Veillard | a235132 | 2004-06-27 12:08:10 +0000 | [diff] [blame] | 103 | #endif /* LIBXML_C14N_ENABLED */ |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 104 | #endif /* __XML_C14N_H__ */ |
| 105 | |