blob: e60f229fa26d8e71f62539f886990da609ace430 [file] [log] [blame]
Daniel Veillard1db4a662005-09-12 13:10:09 +00001<?xml version="1.0" encoding="UTF-8"?>
2<html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5 <title>c14n: Provide Canonical XML and Exclusive XML Canonicalization</title>
6 <meta name="generator" content="Libxml2 devhelp stylesheet"/>
7 <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
8 <link rel="up" href="general.html" title="API"/>
9 <link rel="stylesheet" href="style.css" type="text/css"/>
10 <link rel="chapter" href="general.html" title="API"/>
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
14 <tr valign="middle">
15 <td>
16 <a accesskey="p" href="libxml2-SAX2.html">
17 <img src="left.png" width="24" height="24" border="0" alt="Prev"/>
18 </a>
19 </td>
20 <td>
21 <a accesskey="u" href="general.html">
22 <img src="up.png" width="24" height="24" border="0" alt="Up"/>
23 </a>
24 </td>
25 <td>
26 <a accesskey="h" href="index.html">
27 <img src="home.png" width="24" height="24" border="0" alt="Home"/>
28 </a>
29 </td>
30 <td>
31 <a accesskey="n" href="libxml2-catalog.html">
32 <img src="right.png" width="24" height="24" border="0" alt="Next"/>
33 </a>
34 </td>
35 <th width="100%" align="center">libxml2 Reference Manual</th>
36 </tr>
37 </table>
38 <h2>
39 <span class="refentrytitle">c14n</span>
40 </h2>
41 <p>c14n - Provide Canonical XML and Exclusive XML Canonicalization</p>
42 <p>the c14n modules provides a "Canonical XML" implementation</p>
43 <p>Author(s): Aleksey Sanin &lt;aleksey@aleksey.com&gt; </p>
44 <div class="refsynopsisdiv">
45 <h2>Synopsis</h2>
46 <pre class="synopsis">int <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 exclusive, <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);
47int <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 exclusive, <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);
48typedef 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);
49int <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 exclusive, <br/> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br/> int with_comments, <br/> const char * filename, <br/> int compression);
50int <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 exclusive, <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);
51</pre>
52 </div>
53 <div class="refsect1" lang="en">
54 <h2>Description</h2>
55 </div>
56 <div class="refsect1" lang="en">
57 <h2>Details</h2>
58 <div class="refsect2" lang="en">
59 <div class="refsect2" lang="en"><h3><a name="xmlC14NIsVisibleCallback"/>Function type xmlC14NIsVisibleCallback</h3><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/>
Daniel Veillarddee23482008-04-11 12:58:43 +000060</pre><p>Signature for a C14N callback on visible nodes</p>
61<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>user_data</tt></i>:</span></td><td>user data</td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the curent node</td></tr><tr><td><span class="term"><i><tt>parent</tt></i>:</span></td><td>the parent node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the node should be included</td></tr></tbody></table></div></div>
Daniel Veillard1db4a662005-09-12 13:10:09 +000062 <hr/>
63 <div class="refsect2" lang="en"><h3><a name="xmlC14NDocDumpMemory"/>xmlC14NDocDumpMemory ()</h3><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 exclusive, <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/>
64</pre><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>
65<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document for canonization</td></tr><tr><td><span class="term"><i><tt>nodes</tt></i>:</span></td><td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td></tr><tr><td><span class="term"><i><tt>exclusive</tt></i>:</span></td><td>the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization)</td></tr><tr><td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td><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></tr><tr><td><span class="term"><i><tt>with_comments</tt></i>:</span></td><td>include comments in the result (!=0) or not (==0)</td></tr><tr><td><span class="term"><i><tt>doc_txt_ptr</tt></i>:</span></td><td>the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written on success or a negative value on fail</td></tr></tbody></table></div></div>
66 <hr/>
67 <div class="refsect2" lang="en"><h3><a name="xmlC14NDocSave"/>xmlC14NDocSave ()</h3><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 exclusive, <br/> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** inclusive_ns_prefixes, <br/> int with_comments, <br/> const char * filename, <br/> int compression)<br/>
68</pre><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>
69<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document for canonization</td></tr><tr><td><span class="term"><i><tt>nodes</tt></i>:</span></td><td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td></tr><tr><td><span class="term"><i><tt>exclusive</tt></i>:</span></td><td>the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization)</td></tr><tr><td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td><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></tr><tr><td><span class="term"><i><tt>with_comments</tt></i>:</span></td><td>include comments in the result (!=0) or not (==0)</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the filename to store canonical XML image</td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, &gt;0 - compression level</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written success or a negative value on fail</td></tr></tbody></table></div></div>
70 <hr/>
71 <div class="refsect2" lang="en"><h3><a name="xmlC14NDocSaveTo"/>xmlC14NDocSaveTo ()</h3><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 exclusive, <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/>
72</pre><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>
73<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document for canonization</td></tr><tr><td><span class="term"><i><tt>nodes</tt></i>:</span></td><td>the nodes set to be included in the canonized image or NULL if all document nodes should be included</td></tr><tr><td><span class="term"><i><tt>exclusive</tt></i>:</span></td><td>the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization)</td></tr><tr><td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td><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></tr><tr><td><span class="term"><i><tt>with_comments</tt></i>:</span></td><td>include comments in the result (!=0) or not (==0)</td></tr><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>non-negative value on success or a negative value on fail</td></tr></tbody></table></div></div>
74 <hr/>
75 <div class="refsect2" lang="en"><h3><a name="xmlC14NExecute"/>xmlC14NExecute ()</h3><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 exclusive, <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/>
76</pre><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>
77<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document for canonization</td></tr><tr><td><span class="term"><i><tt>is_visible_callback</tt></i>:</span></td><td>the function to use to determine is node visible or not</td></tr><tr><td><span class="term"><i><tt>user_data</tt></i>:</span></td><td>the first parameter for @is_visible_callback function (in most cases, it is nodes set)</td></tr><tr><td><span class="term"><i><tt>exclusive</tt></i>:</span></td><td>the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization)</td></tr><tr><td><span class="term"><i><tt>inclusive_ns_prefixes</tt></i>:</span></td><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></tr><tr><td><span class="term"><i><tt>with_comments</tt></i>:</span></td><td>include comments in the result (!=0) or not (==0)</td></tr><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>non-negative value on success or a negative value on fail</td></tr></tbody></table></div></div>
78 <hr/>
79 </div>
80 </div>
81 </body>
82</html>