libxml-DOCBparser.html revision 93d95255e58d727fb69683646ec085d424bc34e7
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>DOCBparser</title><meta name="generator" content="DocBook XSL Stylesheets V1.58.1"><style xmlns="http://www.w3.org/TR/xhtml1/transitional" type="text/css"> 3 .synopsis, .classsynopsis { 4 background: #eeeeee; 5 border: solid 1px #aaaaaa; 6 padding: 0.5em; 7 } 8 .programlisting { 9 background: #eeeeff; 10 border: solid 1px #aaaaff; 11 padding: 0.5em; 12 } 13 .variablelist { 14 padding: 4px; 15 margin-left: 3em; 16 } 17 .navigation { 18 background: #ffeeee; 19 border: solid 1px #ffaaaa; 20 margin-top: 0.5em; 21 margin-bottom: 0.5em; 22 } 23 .navigation a { 24 color: #770000; 25 } 26 .navigation a:visited { 27 color: #550000; 28 } 29 .navigation .title { 30 font-size: 200%; 31 } 32 </style><link rel="home" href="index.html" title="Gnome XML Library Reference Manual"><link rel="up" href="libxml-lib.html" title="Libxml Library Reference"><link rel="previous" href="libxml-globals.html" title="globals"><link rel="next" href="libxml-parserInternals.html" title="parserInternals"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-globals.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td><td><a accesskey="u" href="libxml-lib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td><th width="100%" align="center">Gnome XML Library Reference Manual</th><td><a accesskey="n" href="libxml-parserInternals.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td></tr></table><div class="refentry" lang="en"><a name="libxml-DOCBparser"></a><div class="titlepage"></div><div class="refnamediv"><h2>DOCBparser</h2><p>DOCBparser — </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis"> 33 34 35 36typedef <a href="libxml-DOCBparser.html#docbParserCtxt">docbParserCtxt</a>; 37typedef <a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a>; 38typedef <a href="libxml-DOCBparser.html#docbParserNodeInfo">docbParserNodeInfo</a>; 39typedef <a href="libxml-DOCBparser.html#docbSAXHandler">docbSAXHandler</a>; 40typedef <a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a>; 41typedef <a href="libxml-DOCBparser.html#docbParserInput">docbParserInput</a>; 42typedef <a href="libxml-DOCBparser.html#docbParserInputPtr">docbParserInputPtr</a>; 43typedef <a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a>; 44typedef <a href="libxml-DOCBparser.html#docbNodePtr">docbNodePtr</a>; 45int <a href="libxml-DOCBparser.html#docbEncodeEntities">docbEncodeEntities</a> (unsigned char *out, 46 int *outlen, 47 unsigned char *in, 48 int *inlen, 49 int quoteChar); 50<a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> <a href="libxml-DOCBparser.html#docbSAXParseDoc">docbSAXParseDoc</a> (<a href="libxml-tree.html#xmlChar">xmlChar</a> *cur, 51 const char *encoding, 52 <a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 53 void *userData); 54<a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> <a href="libxml-DOCBparser.html#docbParseDoc">docbParseDoc</a> (<a href="libxml-tree.html#xmlChar">xmlChar</a> *cur, 55 const char *encoding); 56<a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> <a href="libxml-DOCBparser.html#docbSAXParseFile">docbSAXParseFile</a> (const char *filename, 57 const char *encoding, 58 <a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 59 void *userData); 60<a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> <a href="libxml-DOCBparser.html#docbParseFile">docbParseFile</a> (const char *filename, 61 const char *encoding); 62void <a href="libxml-DOCBparser.html#docbFreeParserCtxt">docbFreeParserCtxt</a> (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt); 63<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> <a href="libxml-DOCBparser.html#docbCreatePushParserCtxt">docbCreatePushParserCtxt</a> (<a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 64 void *user_data, 65 const char *chunk, 66 int size, 67 const char *filename, 68 <a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc); 69int <a href="libxml-DOCBparser.html#docbParseChunk">docbParseChunk</a> (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt, 70 const char *chunk, 71 int size, 72 int terminate); 73<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> <a href="libxml-DOCBparser.html#docbCreateFileParserCtxt">docbCreateFileParserCtxt</a> (const char *filename, 74 const char *encoding); 75int <a href="libxml-DOCBparser.html#docbParseDocument">docbParseDocument</a> (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt); 76</pre></div><div class="refsect1" lang="en"><h2>Description</h2><p> 77 78</p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="docbParserCtxt"></a>docbParserCtxt</h3><p> 79 80</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParserCtxtPtr"></a>docbParserCtxtPtr</h3><p> 81 82</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParserNodeInfo"></a>docbParserNodeInfo</h3><p> 83 84</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbSAXHandler"></a>docbSAXHandler</h3><p> 85 86</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbSAXHandlerPtr"></a>docbSAXHandlerPtr</h3><p> 87 88</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParserInput"></a>docbParserInput</h3><p> 89 90</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParserInputPtr"></a>docbParserInputPtr</h3><p> 91 92</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbDocPtr"></a>docbDocPtr</h3><p> 93 94</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbNodePtr"></a>docbNodePtr</h3><p> 95 96</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbEncodeEntities"></a>docbEncodeEntities ()</h3><pre class="programlisting">int docbEncodeEntities (unsigned char *out, 97 int *outlen, 98 unsigned char *in, 99 int *inlen, 100 int quoteChar);</pre><p> 101Take a block of UTF-8 chars in and try to convert it to an ASCII 102plus SGML entities block of chars out.</p><p> 103 104</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>out</tt></i>�:</span></td><td> 105</td></tr><tr><td><span class="term"><i><tt>outlen</tt></i>�:</span></td><td> 106</td></tr><tr><td><span class="term"><i><tt>in</tt></i>�:</span></td><td> 107</td></tr><tr><td><span class="term"><i><tt>inlen</tt></i>�:</span></td><td> 108</td></tr><tr><td><span class="term"><i><tt>quoteChar</tt></i>�:</span></td><td> 109</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 110 111 112</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbSAXParseDoc"></a>docbSAXParseDoc ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> docbSAXParseDoc (<a href="libxml-tree.html#xmlChar">xmlChar</a> *cur, 113 const char *encoding, 114 <a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 115 void *userData);</pre><p> 116parse an SGML in-memory document and build a tree. 117It use the given SAX function block to handle the parsing callback. 118If sax is NULL, fallback to the default DOM tree building routines.</p><p> 119 120</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>cur</tt></i>�:</span></td><td> 121</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>�:</span></td><td> 122</td></tr><tr><td><span class="term"><i><tt>sax</tt></i>�:</span></td><td> 123</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>�:</span></td><td> 124</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 125 126 127</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParseDoc"></a>docbParseDoc ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> docbParseDoc (<a href="libxml-tree.html#xmlChar">xmlChar</a> *cur, 128 const char *encoding);</pre><p> 129parse an SGML in-memory document and build a tree.</p><p> 130 131</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>cur</tt></i>�:</span></td><td> 132</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>�:</span></td><td> 133</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 134 135 136</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbSAXParseFile"></a>docbSAXParseFile ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> docbSAXParseFile (const char *filename, 137 const char *encoding, 138 <a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 139 void *userData);</pre><p> 140parse an SGML file and build a tree. Automatic support for ZLIB/Compress 141compressed document is provided by default if found at compile-time. 142It use the given SAX function block to handle the parsing callback. 143If sax is NULL, fallback to the default DOM tree building routines.</p><p> 144 145</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>filename</tt></i>�:</span></td><td> 146</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>�:</span></td><td> 147</td></tr><tr><td><span class="term"><i><tt>sax</tt></i>�:</span></td><td> 148</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>�:</span></td><td> 149</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 150 151 152</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParseFile"></a>docbParseFile ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbDocPtr">docbDocPtr</a> docbParseFile (const char *filename, 153 const char *encoding);</pre><p> 154parse a Docbook SGML file and build a tree. Automatic support for 155ZLIB/Compress compressed document is provided by default if found 156at compile-time.</p><p> 157 158</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>filename</tt></i>�:</span></td><td> 159</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>�:</span></td><td> 160</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 161 162 163</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbFreeParserCtxt"></a>docbFreeParserCtxt ()</h3><pre class="programlisting">void docbFreeParserCtxt (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt);</pre><p> 164Free all the memory used by a parser context. However the parsed 165document in ctxt->myDoc is not freed.</p><p> 166 167</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>�:</span></td><td> 168 169 170</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbCreatePushParserCtxt"></a>docbCreatePushParserCtxt ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> docbCreatePushParserCtxt (<a href="libxml-DOCBparser.html#docbSAXHandlerPtr">docbSAXHandlerPtr</a> sax, 171 void *user_data, 172 const char *chunk, 173 int size, 174 const char *filename, 175 <a href="libxml-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);</pre><p> 176Create a parser context for using the DocBook SGML parser in push mode 177To allow content encoding detection, <i><tt>size</tt></i> should be >= 4 178The value of <i><tt>filename</tt></i> is used for fetching external entities 179and error/warning reports.</p><p> 180 181</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>sax</tt></i>�:</span></td><td> 182</td></tr><tr><td><span class="term"><i><tt>user_data</tt></i>�:</span></td><td> 183</td></tr><tr><td><span class="term"><i><tt>chunk</tt></i>�:</span></td><td> 184</td></tr><tr><td><span class="term"><i><tt>size</tt></i>�:</span></td><td> 185</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>�:</span></td><td> 186</td></tr><tr><td><span class="term"><i><tt>enc</tt></i>�:</span></td><td> 187</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 188 189 190</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParseChunk"></a>docbParseChunk ()</h3><pre class="programlisting">int docbParseChunk (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt, 191 const char *chunk, 192 int size, 193 int terminate);</pre><p> 194Parse a Chunk of memory</p><p> 195 196</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>�:</span></td><td> 197</td></tr><tr><td><span class="term"><i><tt>chunk</tt></i>�:</span></td><td> 198</td></tr><tr><td><span class="term"><i><tt>size</tt></i>�:</span></td><td> 199</td></tr><tr><td><span class="term"><i><tt>terminate</tt></i>�:</span></td><td> 200</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 201 202 203</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbCreateFileParserCtxt"></a>docbCreateFileParserCtxt ()</h3><pre class="programlisting"><a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> docbCreateFileParserCtxt (const char *filename, 204 const char *encoding);</pre><p> 205Create a parser context for a file content. 206Automatic support for ZLIB/Compress compressed document is provided 207by default if found at compile-time.</p><p> 208 209</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>filename</tt></i>�:</span></td><td> 210</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>�:</span></td><td> 211</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 212 213 214</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="docbParseDocument"></a>docbParseDocument ()</h3><pre class="programlisting">int docbParseDocument (<a href="libxml-DOCBparser.html#docbParserCtxtPtr">docbParserCtxtPtr</a> ctxt);</pre><p> 215parse an SGML document (and build a tree if using the standard SAX 216interface).</p><p> 217 218</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>�:</span></td><td> 219</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 220 221 222</td></tr></tbody></table></div></div></div></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-globals.html"><b><<�globals</b></a></td><td align="right"><a accesskey="n" href="libxml-parserInternals.html"><b>parserInternals�>></b></a></td></tr></table></body></html> 223