Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 1 | * Summary: Provide Canonical XML and Exclusive XML Canonicalization |
| 2 | * Description: the c14n modules provides a |
| 3 | * |
| 4 | * "Canonical XML" implementation |
| 5 | * http://www.w3.org/TR/xml-c14n |
| 6 | * |
| 7 | * and an |
| 8 | * |
| 9 | * "Exclusive XML Canonicalization" implementation |
| 10 | * http://www.w3.org/TR/xml-exc-c14n |
| 11 | * |
| 12 | * Copy: See Copyright for the status of this software. |
| 13 | * |
| 14 | * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A. |
| 15 | |
| 16 | /if not defined(XML_C14N_H__) |
| 17 | /define XML_C14N_H__ |
| 18 | |
| 19 | /include "libxmlrpg/xmlversion" |
| 20 | |
| 21 | /if defined(LIBXML_C14N_ENABLED) |
| 22 | /if defined(LIBXML_OUTPUT_ENABLED) |
| 23 | |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 24 | /include "libxmlrpg/xmlTypesC" |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 25 | /include "libxmlrpg/tree" |
| 26 | /include "libxmlrpg/xpath" |
| 27 | |
| 28 | * XML Canonicazation |
| 29 | * http://www.w3.org/TR/xml-c14n |
| 30 | * |
| 31 | * Exclusive XML Canonicazation |
| 32 | * http://www.w3.org/TR/xml-exc-c14n |
| 33 | * |
| 34 | * Canonical form of an XML document could be created if and only if |
| 35 | * a) default attributes (if any) are added to all nodes |
| 36 | * b) all character and parsed entity references are resolved |
| 37 | * In order to achive this in libxml2 the document MUST be loaded with |
| 38 | * following global setings: |
| 39 | * |
| 40 | * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS ã XML_COMPLETE_ATTRS; |
| 41 | * xmlSubstituteEntitiesDefault(1); |
| 42 | * |
| 43 | * or corresponding parser context setting: |
| 44 | * xmlParserCtxtPtr ctxt; |
| 45 | * |
| 46 | * ... |
| 47 | * ctxt->loadsubset = XML_DETECT_IDS ã XML_COMPLETE_ATTRS; |
| 48 | * ctxt->replaceEntities = 1; |
| 49 | * ... |
| 50 | |
| 51 | * xmlC14NMode: |
| 52 | * |
| 53 | * Predefined values for C14N modes |
| 54 | |
| 55 | d xmlBufferAllocationScheme... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 56 | d xmlC14NMode s based(######typedef######) |
| 57 | d like(xmlCenum) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 58 | d XML_C14N_1_0 c 0 Original C14N 1.0 |
| 59 | d XML_C14N_EXCLUSIVE_1_0... Exclusive C14N 1.0 |
| 60 | d c 1 |
| 61 | d XML_C14N_1_1 c 2 C14N 1.1 spec |
| 62 | |
| 63 | d xmlC14NDocSaveTo... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 64 | d pr extproc('xmlC14NDocSaveTo') |
| 65 | d like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 66 | d doc value like(xmlDocPtr) |
| 67 | d nodes value like(xmlNodeSetPtr) |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 68 | d mode value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 69 | d inclusive_ns_prefixes... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 70 | d * options(*omit) xmlChar *(*) |
| 71 | d with_comments value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 72 | d buf value like(xmlOutputBufferPtr) |
| 73 | |
| 74 | d xmlC14NDocDumpMemory... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 75 | d pr extproc('xmlC14NDocDumpMemory') |
| 76 | d like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 77 | d doc value like(xmlDocPtr) |
| 78 | d nodes value like(xmlNodeSetPtr) |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 79 | d mode value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 80 | d inclusive_ns_prefixes... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 81 | d * options(*omit) xmlChar *(*) |
| 82 | d with_comments value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 83 | d doc_txt_ptr * xmlChar *(*) |
| 84 | |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 85 | d xmlC14NDocSave pr extproc('xmlC14NDocSave') |
| 86 | d like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 87 | d doc value like(xmlDocPtr) |
| 88 | d nodes value like(xmlNodeSetPtr) |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 89 | d mode value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 90 | d inclusive_ns_prefixes... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 91 | d * options(*omit) xmlChar *(*) |
| 92 | d with_comments value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 93 | d filename * value options(*string) const char * |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 94 | d compression value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 95 | |
| 96 | * This is the core C14N function |
| 97 | |
| 98 | * xmlC14NIsVisibleCallback: |
| 99 | * @user_data: user data |
| 100 | * @node: the curent node |
| 101 | * @parent: the parent node |
| 102 | * |
| 103 | * Signature for a C14N callback on visible nodes |
| 104 | * |
| 105 | * Returns 1 if the node should be included |
| 106 | |
| 107 | d xmlC14NIsVisibleCallback... |
| 108 | d s * based(######typedef######) |
| 109 | d procptr |
| 110 | |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 111 | d xmlC14NExecute pr extproc('xmlC14NExecute') |
| 112 | d like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 113 | d doc value like(xmlDocPtr) |
| 114 | d is_visible_callback... |
| 115 | d value like(xmlC14NIsVisibleCallback) |
| 116 | d user_data * value void * |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 117 | d mode value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 118 | d inclusive_ns_prefixes... |
Xin Li | a136fc2 | 2016-07-26 14:22:54 -0700 | [diff] [blame] | 119 | d * options(*omit) xmlChar *(*) |
| 120 | d with_comments value like(xmlCint) |
Patrick Monnerat | e083c30 | 2014-03-04 17:18:26 +0100 | [diff] [blame] | 121 | d buf value like(xmlOutputBufferPtr) |
| 122 | |
| 123 | /endif LIBXML_OUTPUT_ENABLD |
| 124 | /endif LIBXML_C14N_ENABLED |
| 125 | /endif XML_C14N_H__ |