• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>c14n: Provide Canonical XML and Exclusive XML Canonicalization</title>
5<meta name="generator" content="Libxml2 devhelp stylesheet">
6<link rel="start" href="index.html" title="libxml2 Reference Manual">
7<link rel="up" href="general.html" title="API">
8<link rel="stylesheet" href="style.css" type="text/css">
9<link rel="chapter" href="general.html" title="API">
10</head>
11<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
12<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
13<td><a accesskey="p" href="libxml2-SAX2.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
14<td><a accesskey="u" href="general.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
15<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
16<td><a accesskey="n" href="libxml2-catalog.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
17<th width="100%" align="center">libxml2 Reference Manual</th>
18</tr></table>
19<h2><span class="refentrytitle">c14n</span></h2>
20<p>c14n - Provide Canonical XML and Exclusive XML Canonicalization</p>
21<p>the c14n modules provides a  "Canonical XML" implementation</p>
22<p>Author(s): Aleksey Sanin &lt;aleksey@aleksey.com&gt; </p>
23<div class="refsynopsisdiv">
24<h2>Synopsis</h2>
25<pre class="synopsis">typedef enum <a href="#xmlC14NMode">xmlC14NMode</a>;
26int	<a href="#xmlC14NDocDumpMemory">xmlC14NDocDumpMemory</a>		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** doc_txt_ptr);
27int	<a href="#xmlC14NDocSave">xmlC14NDocSave</a>			(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 const char * filename, <br>					 int compression);
28int	<a href="#xmlC14NDocSaveTo">xmlC14NDocSaveTo</a>		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf);
29int	<a href="#xmlC14NExecute">xmlC14NExecute</a>			(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-c14n.html#xmlC14NIsVisibleCallback">xmlC14NIsVisibleCallback</a> is_visible_callback, <br>					 void * user_data, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf);
30typedef int <a href="#xmlC14NIsVisibleCallback">xmlC14NIsVisibleCallback</a>	(void * user_data, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> parent);
31</pre>
32</div>
33<div class="refsect1" lang="en"><h2>Description</h2></div>
34<div class="refsect1" lang="en">
35<h2>Details</h2>
36<div class="refsect2" lang="en">
37<div class="refsect2" lang="en">
38<h3>
39<a name="xmlC14NMode">Enum </a>xmlC14NMode</h3>
40<pre class="programlisting">enum <a href="#xmlC14NMode">xmlC14NMode</a> {
41    <a name="XML_C14N_1_0">XML_C14N_1_0</a> = 0 /* Original C14N 1.0 spec */
42    <a name="XML_C14N_EXCLUSIVE_1_0">XML_C14N_EXCLUSIVE_1_0</a> = 1 /* Exclusive C14N 1.0 spec */
43    <a name="XML_C14N_1_1">XML_C14N_1_1</a> = 2 /*  C14N 1.1 spec */
44};
45</pre>
46<p></p>
47</div>
48<hr>
49<div class="refsect2" lang="en">
50<h3>
51<a name="xmlC14NIsVisibleCallback"></a>Function type xmlC14NIsVisibleCallback</h3>
52<pre class="programlisting">int	xmlC14NIsVisibleCallback	(void * user_data, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> parent)<br>
53</pre>
54<p>Signature for a C14N callback on visible nodes</p>
55<div class="variablelist"><table border="0">
56<col align="left">
57<tbody>
58<tr>
59<td><span class="term"><i><tt>user_data</tt></i>:</span></td>
60<td>user data</td>
61</tr>
62<tr>
63<td><span class="term"><i><tt>node</tt></i>:</span></td>
64<td>the current node</td>
65</tr>
66<tr>
67<td><span class="term"><i><tt>parent</tt></i>:</span></td>
68<td>the parent node</td>
69</tr>
70<tr>
71<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
72<td>1 if the node should be included</td>
73</tr>
74</tbody>
75</table></div>
76</div>
77<hr>
78<div class="refsect2" lang="en">
79<h3>
80<a name="xmlC14NDocDumpMemory"></a>xmlC14NDocDumpMemory ()</h3>
81<pre class="programlisting">int	xmlC14NDocDumpMemory		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** doc_txt_ptr)<br>
82</pre>
83<p>Dumps the canonized image of given XML document into memory. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)</p>
84<div class="variablelist"><table border="0">
85<col align="left">
86<tbody>
87<tr>
88<td><span class="term"><i><tt>doc</tt></i>:</span></td>
89<td>the XML document for canonization</td>
90</tr>
91<tr>
92<td><span class="term"><i><tt>nodes</tt></i>:</span></td>
93<td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td>
94</tr>
95<tr>
96<td><span class="term"><i><tt>mode</tt></i>:</span></td>
97<td>the c14n mode (see @xmlC14NMode)</td>
98</tr>
99<tr>
100<td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td>
101<td>the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise)</td>
102</tr>
103<tr>
104<td><span class="term"><i><tt>with_comments</tt></i>:</span></td>
105<td>include comments in the result (!=0) or not (==0)</td>
106</tr>
107<tr>
108<td><span class="term"><i><tt>doc_txt_ptr</tt></i>:</span></td>
109<td>the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory</td>
110</tr>
111<tr>
112<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
113<td>the number of bytes written on success or a negative value on fail</td>
114</tr>
115</tbody>
116</table></div>
117</div>
118<hr>
119<div class="refsect2" lang="en">
120<h3>
121<a name="xmlC14NDocSave"></a>xmlC14NDocSave ()</h3>
122<pre class="programlisting">int	xmlC14NDocSave			(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 const char * filename, <br>					 int compression)<br>
123</pre>
124<p>Dumps the canonized image of given XML document into the file. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)</p>
125<div class="variablelist"><table border="0">
126<col align="left">
127<tbody>
128<tr>
129<td><span class="term"><i><tt>doc</tt></i>:</span></td>
130<td>the XML document for canonization</td>
131</tr>
132<tr>
133<td><span class="term"><i><tt>nodes</tt></i>:</span></td>
134<td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td>
135</tr>
136<tr>
137<td><span class="term"><i><tt>mode</tt></i>:</span></td>
138<td>the c14n mode (see @xmlC14NMode)</td>
139</tr>
140<tr>
141<td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td>
142<td>the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise)</td>
143</tr>
144<tr>
145<td><span class="term"><i><tt>with_comments</tt></i>:</span></td>
146<td>include comments in the result (!=0) or not (==0)</td>
147</tr>
148<tr>
149<td><span class="term"><i><tt>filename</tt></i>:</span></td>
150<td>the filename to store canonical XML image</td>
151</tr>
152<tr>
153<td><span class="term"><i><tt>compression</tt></i>:</span></td>
154<td>the compression level (zlib required): -1 - libxml default, 0 - uncompressed, &gt;0 - compression level</td>
155</tr>
156<tr>
157<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
158<td>the number of bytes written success or a negative value on fail</td>
159</tr>
160</tbody>
161</table></div>
162</div>
163<hr>
164<div class="refsect2" lang="en">
165<h3>
166<a name="xmlC14NDocSaveTo"></a>xmlC14NDocSaveTo ()</h3>
167<pre class="programlisting">int	xmlC14NDocSaveTo		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodes, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf)<br>
168</pre>
169<p>Dumps the canonized image of given XML document into the provided buffer. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)</p>
170<div class="variablelist"><table border="0">
171<col align="left">
172<tbody>
173<tr>
174<td><span class="term"><i><tt>doc</tt></i>:</span></td>
175<td>the XML document for canonization</td>
176</tr>
177<tr>
178<td><span class="term"><i><tt>nodes</tt></i>:</span></td>
179<td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td>
180</tr>
181<tr>
182<td><span class="term"><i><tt>mode</tt></i>:</span></td>
183<td>the c14n mode (see @xmlC14NMode)</td>
184</tr>
185<tr>
186<td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td>
187<td>the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise)</td>
188</tr>
189<tr>
190<td><span class="term"><i><tt>with_comments</tt></i>:</span></td>
191<td>include comments in the result (!=0) or not (==0)</td>
192</tr>
193<tr>
194<td><span class="term"><i><tt>buf</tt></i>:</span></td>
195<td>the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output</td>
196</tr>
197<tr>
198<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
199<td>non-negative value on success or a negative value on fail</td>
200</tr>
201</tbody>
202</table></div>
203</div>
204<hr>
205<div class="refsect2" lang="en">
206<h3>
207<a name="xmlC14NExecute"></a>xmlC14NExecute ()</h3>
208<pre class="programlisting">int	xmlC14NExecute			(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 <a href="libxml2-c14n.html#xmlC14NIsVisibleCallback">xmlC14NIsVisibleCallback</a> is_visible_callback, <br>					 void * user_data, <br>					 int mode, <br>					 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br>					 int with_comments, <br>					 <a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf)<br>
209</pre>
210<p>Dumps the canonized image of given XML document into the provided buffer. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)</p>
211<div class="variablelist"><table border="0">
212<col align="left">
213<tbody>
214<tr>
215<td><span class="term"><i><tt>doc</tt></i>:</span></td>
216<td>the XML document for canonization</td>
217</tr>
218<tr>
219<td><span class="term"><i><tt>is_visible_callback</tt></i>:</span></td>
220<td>the function to use to determine is node visible or not</td>
221</tr>
222<tr>
223<td><span class="term"><i><tt>user_data</tt></i>:</span></td>
224<td>the first parameter for @is_visible_callback function (in most cases, it is nodes set)</td>
225</tr>
226<tr>
227<td><span class="term"><i><tt>mode</tt></i>:</span></td>
228<td>the c14n mode (see @xmlC14NMode)</td>
229</tr>
230<tr>
231<td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td>
232<td>the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise)</td>
233</tr>
234<tr>
235<td><span class="term"><i><tt>with_comments</tt></i>:</span></td>
236<td>include comments in the result (!=0) or not (==0)</td>
237</tr>
238<tr>
239<td><span class="term"><i><tt>buf</tt></i>:</span></td>
240<td>the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output</td>
241</tr>
242<tr>
243<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
244<td>non-negative value on success or a negative value on fail</td>
245</tr>
246</tbody>
247</table></div>
248</div>
249<hr>
250</div>
251</div>
252</body>
253</html>
254