xref: /aosp_15_r20/external/libxml2/doc/devhelp/libxml2-xinclude.html (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>xinclude: implementation of XInclude</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-valid.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-xlink.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">xinclude</span></h2>
20<p>xinclude - implementation of XInclude</p>
21<p>API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003</p>
22<p>Author(s): Daniel Veillard </p>
23<div class="refsynopsisdiv">
24<h2>Synopsis</h2>
25<pre class="synopsis">#define <a href="#XINCLUDE_FALLBACK">XINCLUDE_FALLBACK</a>;
26#define <a href="#XINCLUDE_HREF">XINCLUDE_HREF</a>;
27#define <a href="#XINCLUDE_NODE">XINCLUDE_NODE</a>;
28#define <a href="#XINCLUDE_NS">XINCLUDE_NS</a>;
29#define <a href="#XINCLUDE_OLD_NS">XINCLUDE_OLD_NS</a>;
30#define <a href="#XINCLUDE_PARSE">XINCLUDE_PARSE</a>;
31#define <a href="#XINCLUDE_PARSE_ENCODING">XINCLUDE_PARSE_ENCODING</a>;
32#define <a href="#XINCLUDE_PARSE_TEXT">XINCLUDE_PARSE_TEXT</a>;
33#define <a href="#XINCLUDE_PARSE_XML">XINCLUDE_PARSE_XML</a>;
34#define <a href="#XINCLUDE_PARSE_XPOINTER">XINCLUDE_PARSE_XPOINTER</a>;
35typedef struct _xmlXIncludeCtxt <a href="#xmlXIncludeCtxt">xmlXIncludeCtxt</a>;
36typedef <a href="libxml2-xinclude.html#xmlXIncludeCtxt">xmlXIncludeCtxt</a> * <a href="#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a>;
37void	<a href="#xmlXIncludeFreeContext">xmlXIncludeFreeContext</a>		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt);
38int	<a href="#xmlXIncludeGetLastError">xmlXIncludeGetLastError</a>		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt);
39<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a>	<a href="#xmlXIncludeNewContext">xmlXIncludeNewContext</a>	(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
40int	<a href="#xmlXIncludeProcess">xmlXIncludeProcess</a>		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
41int	<a href="#xmlXIncludeProcessFlags">xmlXIncludeProcessFlags</a>		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 int flags);
42int	<a href="#xmlXIncludeProcessFlagsData">xmlXIncludeProcessFlagsData</a>	(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 int flags, <br>					 void * data);
43int	<a href="#xmlXIncludeProcessNode">xmlXIncludeProcessNode</a>		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node);
44int	<a href="#xmlXIncludeProcessTree">xmlXIncludeProcessTree</a>		(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree);
45int	<a href="#xmlXIncludeProcessTreeFlags">xmlXIncludeProcessTreeFlags</a>	(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree, <br>					 int flags);
46int	<a href="#xmlXIncludeProcessTreeFlagsData">xmlXIncludeProcessTreeFlagsData</a>	(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree, <br>					 int flags, <br>					 void * data);
47void	<a href="#xmlXIncludeSetErrorHandler">xmlXIncludeSetErrorHandler</a>	(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> handler, <br>					 void * data);
48int	<a href="#xmlXIncludeSetFlags">xmlXIncludeSetFlags</a>		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 int flags);
49</pre>
50</div>
51<div class="refsect1" lang="en"><h2>Description</h2></div>
52<div class="refsect1" lang="en">
53<h2>Details</h2>
54<div class="refsect2" lang="en">
55<div class="refsect2" lang="en">
56<h3>
57<a name="XINCLUDE_FALLBACK">Macro </a>XINCLUDE_FALLBACK</h3>
58<pre class="programlisting">#define <a href="#XINCLUDE_FALLBACK">XINCLUDE_FALLBACK</a>;
59</pre>
60<p>Macro defining "fallback"</p>
61</div>
62<hr>
63<div class="refsect2" lang="en">
64<h3>
65<a name="XINCLUDE_HREF">Macro </a>XINCLUDE_HREF</h3>
66<pre class="programlisting">#define <a href="#XINCLUDE_HREF">XINCLUDE_HREF</a>;
67</pre>
68<p>Macro defining "href"</p>
69</div>
70<hr>
71<div class="refsect2" lang="en">
72<h3>
73<a name="XINCLUDE_NODE">Macro </a>XINCLUDE_NODE</h3>
74<pre class="programlisting">#define <a href="#XINCLUDE_NODE">XINCLUDE_NODE</a>;
75</pre>
76<p>Macro defining "include"</p>
77</div>
78<hr>
79<div class="refsect2" lang="en">
80<h3>
81<a name="XINCLUDE_NS">Macro </a>XINCLUDE_NS</h3>
82<pre class="programlisting">#define <a href="#XINCLUDE_NS">XINCLUDE_NS</a>;
83</pre>
84<p>Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude</p>
85</div>
86<hr>
87<div class="refsect2" lang="en">
88<h3>
89<a name="XINCLUDE_OLD_NS">Macro </a>XINCLUDE_OLD_NS</h3>
90<pre class="programlisting">#define <a href="#XINCLUDE_OLD_NS">XINCLUDE_OLD_NS</a>;
91</pre>
92<p>Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude</p>
93</div>
94<hr>
95<div class="refsect2" lang="en">
96<h3>
97<a name="XINCLUDE_PARSE">Macro </a>XINCLUDE_PARSE</h3>
98<pre class="programlisting">#define <a href="#XINCLUDE_PARSE">XINCLUDE_PARSE</a>;
99</pre>
100<p>Macro defining "parse"</p>
101</div>
102<hr>
103<div class="refsect2" lang="en">
104<h3>
105<a name="XINCLUDE_PARSE_ENCODING">Macro </a>XINCLUDE_PARSE_ENCODING</h3>
106<pre class="programlisting">#define <a href="#XINCLUDE_PARSE_ENCODING">XINCLUDE_PARSE_ENCODING</a>;
107</pre>
108<p>Macro defining "encoding"</p>
109</div>
110<hr>
111<div class="refsect2" lang="en">
112<h3>
113<a name="XINCLUDE_PARSE_TEXT">Macro </a>XINCLUDE_PARSE_TEXT</h3>
114<pre class="programlisting">#define <a href="#XINCLUDE_PARSE_TEXT">XINCLUDE_PARSE_TEXT</a>;
115</pre>
116<p>Macro defining "text"</p>
117</div>
118<hr>
119<div class="refsect2" lang="en">
120<h3>
121<a name="XINCLUDE_PARSE_XML">Macro </a>XINCLUDE_PARSE_XML</h3>
122<pre class="programlisting">#define <a href="#XINCLUDE_PARSE_XML">XINCLUDE_PARSE_XML</a>;
123</pre>
124<p>Macro defining "xml"</p>
125</div>
126<hr>
127<div class="refsect2" lang="en">
128<h3>
129<a name="XINCLUDE_PARSE_XPOINTER">Macro </a>XINCLUDE_PARSE_XPOINTER</h3>
130<pre class="programlisting">#define <a href="#XINCLUDE_PARSE_XPOINTER">XINCLUDE_PARSE_XPOINTER</a>;
131</pre>
132<p>Macro defining "xpointer"</p>
133</div>
134<hr>
135<div class="refsect2" lang="en">
136<h3>
137<a name="xmlXIncludeCtxt">Structure </a>xmlXIncludeCtxt</h3>
138<pre class="programlisting">struct _xmlXIncludeCtxt {
139The content of this structure is not made public by the API.
140} xmlXIncludeCtxt;
141</pre>
142<p></p>
143</div>
144<hr>
145<div class="refsect2" lang="en">
146<h3>
147<a name="xmlXIncludeCtxtPtr">Typedef </a>xmlXIncludeCtxtPtr</h3>
148<pre class="programlisting"><a href="libxml2-xinclude.html#xmlXIncludeCtxt">xmlXIncludeCtxt</a> * xmlXIncludeCtxtPtr;
149</pre>
150<p></p>
151</div>
152<hr>
153<div class="refsect2" lang="en">
154<h3>
155<a name="xmlXIncludeFreeContext"></a>xmlXIncludeFreeContext ()</h3>
156<pre class="programlisting">void	xmlXIncludeFreeContext		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt)<br>
157</pre>
158<p>Free an XInclude context</p>
159<div class="variablelist"><table border="0">
160<col align="left">
161<tbody><tr>
162<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
163<td>the XInclude context</td>
164</tr></tbody>
165</table></div>
166</div>
167<hr>
168<div class="refsect2" lang="en">
169<h3>
170<a name="xmlXIncludeGetLastError"></a>xmlXIncludeGetLastError ()</h3>
171<pre class="programlisting">int	xmlXIncludeGetLastError		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt)<br>
172</pre>
173<p>Available since 2.13.0.</p>
174<div class="variablelist"><table border="0">
175<col align="left">
176<tbody>
177<tr>
178<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
179<td>an XInclude processing context</td>
180</tr>
181<tr>
182<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
183<td>the last error code.</td>
184</tr>
185</tbody>
186</table></div>
187</div>
188<hr>
189<div class="refsect2" lang="en">
190<h3>
191<a name="xmlXIncludeNewContext"></a>xmlXIncludeNewContext ()</h3>
192<pre class="programlisting"><a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a>	xmlXIncludeNewContext	(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br>
193</pre>
194<p>Creates a new XInclude context</p>
195<div class="variablelist"><table border="0">
196<col align="left">
197<tbody>
198<tr>
199<td><span class="term"><i><tt>doc</tt></i>:</span></td>
200<td>an XML Document</td>
201</tr>
202<tr>
203<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
204<td>the new set</td>
205</tr>
206</tbody>
207</table></div>
208</div>
209<hr>
210<div class="refsect2" lang="en">
211<h3>
212<a name="xmlXIncludeProcess"></a>xmlXIncludeProcess ()</h3>
213<pre class="programlisting">int	xmlXIncludeProcess		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br>
214</pre>
215<p>Implement the XInclude substitution on the XML document @doc</p>
216<div class="variablelist"><table border="0">
217<col align="left">
218<tbody>
219<tr>
220<td><span class="term"><i><tt>doc</tt></i>:</span></td>
221<td>an XML document</td>
222</tr>
223<tr>
224<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
225<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
226</tr>
227</tbody>
228</table></div>
229</div>
230<hr>
231<div class="refsect2" lang="en">
232<h3>
233<a name="xmlXIncludeProcessFlags"></a>xmlXIncludeProcessFlags ()</h3>
234<pre class="programlisting">int	xmlXIncludeProcessFlags		(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 int flags)<br>
235</pre>
236<p>Implement the XInclude substitution on the XML document @doc</p>
237<div class="variablelist"><table border="0">
238<col align="left">
239<tbody>
240<tr>
241<td><span class="term"><i><tt>doc</tt></i>:</span></td>
242<td>an XML document</td>
243</tr>
244<tr>
245<td><span class="term"><i><tt>flags</tt></i>:</span></td>
246<td>a set of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> used for parsing XML includes</td>
247</tr>
248<tr>
249<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
250<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
251</tr>
252</tbody>
253</table></div>
254</div>
255<hr>
256<div class="refsect2" lang="en">
257<h3>
258<a name="xmlXIncludeProcessFlagsData"></a>xmlXIncludeProcessFlagsData ()</h3>
259<pre class="programlisting">int	xmlXIncludeProcessFlagsData	(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>					 int flags, <br>					 void * data)<br>
260</pre>
261<p>Implement the XInclude substitution on the XML document @doc</p>
262<div class="variablelist"><table border="0">
263<col align="left">
264<tbody>
265<tr>
266<td><span class="term"><i><tt>doc</tt></i>:</span></td>
267<td>an XML document</td>
268</tr>
269<tr>
270<td><span class="term"><i><tt>flags</tt></i>:</span></td>
271<td>a set of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> used for parsing XML includes</td>
272</tr>
273<tr>
274<td><span class="term"><i><tt>data</tt></i>:</span></td>
275<td>application data that will be passed to the parser context in the _private field of the parser context(s)</td>
276</tr>
277<tr>
278<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
279<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
280</tr>
281</tbody>
282</table></div>
283</div>
284<hr>
285<div class="refsect2" lang="en">
286<h3>
287<a name="xmlXIncludeProcessNode"></a>xmlXIncludeProcessNode ()</h3>
288<pre class="programlisting">int	xmlXIncludeProcessNode		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br>
289</pre>
290<p>Implement the XInclude substitution for the given subtree reusing the information and data coming from the given context.</p>
291<div class="variablelist"><table border="0">
292<col align="left">
293<tbody>
294<tr>
295<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
296<td>an existing XInclude context</td>
297</tr>
298<tr>
299<td><span class="term"><i><tt>node</tt></i>:</span></td>
300<td>a node in an XML document</td>
301</tr>
302<tr>
303<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
304<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
305</tr>
306</tbody>
307</table></div>
308</div>
309<hr>
310<div class="refsect2" lang="en">
311<h3>
312<a name="xmlXIncludeProcessTree"></a>xmlXIncludeProcessTree ()</h3>
313<pre class="programlisting">int	xmlXIncludeProcessTree		(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree)<br>
314</pre>
315<p>Implement the XInclude substitution for the given subtree</p>
316<div class="variablelist"><table border="0">
317<col align="left">
318<tbody>
319<tr>
320<td><span class="term"><i><tt>tree</tt></i>:</span></td>
321<td>a node in an XML document</td>
322</tr>
323<tr>
324<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
325<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
326</tr>
327</tbody>
328</table></div>
329</div>
330<hr>
331<div class="refsect2" lang="en">
332<h3>
333<a name="xmlXIncludeProcessTreeFlags"></a>xmlXIncludeProcessTreeFlags ()</h3>
334<pre class="programlisting">int	xmlXIncludeProcessTreeFlags	(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree, <br>					 int flags)<br>
335</pre>
336<p>Implement the XInclude substitution for the given subtree</p>
337<div class="variablelist"><table border="0">
338<col align="left">
339<tbody>
340<tr>
341<td><span class="term"><i><tt>tree</tt></i>:</span></td>
342<td>a node in an XML document</td>
343</tr>
344<tr>
345<td><span class="term"><i><tt>flags</tt></i>:</span></td>
346<td>a set of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> used for parsing XML includes</td>
347</tr>
348<tr>
349<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
350<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
351</tr>
352</tbody>
353</table></div>
354</div>
355<hr>
356<div class="refsect2" lang="en">
357<h3>
358<a name="xmlXIncludeProcessTreeFlagsData"></a>xmlXIncludeProcessTreeFlagsData ()</h3>
359<pre class="programlisting">int	xmlXIncludeProcessTreeFlagsData	(<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> tree, <br>					 int flags, <br>					 void * data)<br>
360</pre>
361<p>Implement the XInclude substitution on the XML node @tree</p>
362<div class="variablelist"><table border="0">
363<col align="left">
364<tbody>
365<tr>
366<td><span class="term"><i><tt>tree</tt></i>:</span></td>
367<td>an XML node</td>
368</tr>
369<tr>
370<td><span class="term"><i><tt>flags</tt></i>:</span></td>
371<td>a set of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> used for parsing XML includes</td>
372</tr>
373<tr>
374<td><span class="term"><i><tt>data</tt></i>:</span></td>
375<td>application data that will be passed to the parser context in the _private field of the parser context(s)</td>
376</tr>
377<tr>
378<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
379<td>0 if no substitution were done, -1 if some processing failed or the number of substitutions done.</td>
380</tr>
381</tbody>
382</table></div>
383</div>
384<hr>
385<div class="refsect2" lang="en">
386<h3>
387<a name="xmlXIncludeSetErrorHandler"></a>xmlXIncludeSetErrorHandler ()</h3>
388<pre class="programlisting">void	xmlXIncludeSetErrorHandler	(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> handler, <br>					 void * data)<br>
389</pre>
390<p>Register a callback function that will be called on errors and warnings. If handler is NULL, the error handler will be deactivated. Available since 2.13.0.</p>
391<div class="variablelist"><table border="0">
392<col align="left">
393<tbody>
394<tr>
395<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
396<td>an XInclude processing context</td>
397</tr>
398<tr>
399<td><span class="term"><i><tt>handler</tt></i>:</span></td>
400<td>error handler</td>
401</tr>
402<tr>
403<td><span class="term"><i><tt>data</tt></i>:</span></td>
404<td>user data which will be passed to the handler</td>
405</tr>
406</tbody>
407</table></div>
408</div>
409<hr>
410<div class="refsect2" lang="en">
411<h3>
412<a name="xmlXIncludeSetFlags"></a>xmlXIncludeSetFlags ()</h3>
413<pre class="programlisting">int	xmlXIncludeSetFlags		(<a href="libxml2-xinclude.html#xmlXIncludeCtxtPtr">xmlXIncludeCtxtPtr</a> ctxt, <br>					 int flags)<br>
414</pre>
415<p>Set the flags used for further processing of XML resources.</p>
416<div class="variablelist"><table border="0">
417<col align="left">
418<tbody>
419<tr>
420<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
421<td>an XInclude processing context</td>
422</tr>
423<tr>
424<td><span class="term"><i><tt>flags</tt></i>:</span></td>
425<td>a set of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> used for parsing XML includes</td>
426</tr>
427<tr>
428<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
429<td>0 in case of success and -1 in case of error.</td>
430</tr>
431</tbody>
432</table></div>
433</div>
434<hr>
435</div>
436</div>
437</body>
438</html>
439