1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>HTMLtree: specific APIs to process HTML tree, especially serialization</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-HTMLparser.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-SAX.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">HTMLtree</span></h2> 20<p>HTMLtree - specific APIs to process HTML tree, especially serialization</p> 21<p>this module implements a few function needed to process tree in an HTML specific way. </p> 22<p>Author(s): Daniel Veillard </p> 23<div class="refsynopsisdiv"> 24<h2>Synopsis</h2> 25<pre class="synopsis">#define <a href="#HTML_COMMENT_NODE">HTML_COMMENT_NODE</a>; 26#define <a href="#HTML_ENTITY_REF_NODE">HTML_ENTITY_REF_NODE</a>; 27#define <a href="#HTML_PI_NODE">HTML_PI_NODE</a>; 28#define <a href="#HTML_PRESERVE_NODE">HTML_PRESERVE_NODE</a>; 29#define <a href="#HTML_TEXT_NODE">HTML_TEXT_NODE</a>; 30void <a href="#htmlDocContentDumpFormatOutput">htmlDocContentDumpFormatOutput</a> (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding, <br> int format); 31void <a href="#htmlDocContentDumpOutput">htmlDocContentDumpOutput</a> (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding); 32int <a href="#htmlDocDump">htmlDocDump</a> (FILE * f, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur); 33void <a href="#htmlDocDumpMemory">htmlDocDumpMemory</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** mem, <br> int * size); 34void <a href="#htmlDocDumpMemoryFormat">htmlDocDumpMemoryFormat</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** mem, <br> int * size, <br> int format); 35const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#htmlGetMetaEncoding">htmlGetMetaEncoding</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc); 36int <a href="#htmlIsBooleanAttr">htmlIsBooleanAttr</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name); 37<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlNewDoc">htmlNewDoc</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID); 38<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlNewDocNoDtD">htmlNewDocNoDtD</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID); 39int <a href="#htmlNodeDump">htmlNodeDump</a> (<a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur); 40void <a href="#htmlNodeDumpFile">htmlNodeDumpFile</a> (FILE * out, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur); 41int <a href="#htmlNodeDumpFileFormat">htmlNodeDumpFileFormat</a> (FILE * out, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding, <br> int format); 42void <a href="#htmlNodeDumpFormatOutput">htmlNodeDumpFormatOutput</a> (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding, <br> int format); 43void <a href="#htmlNodeDumpOutput">htmlNodeDumpOutput</a> (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding); 44int <a href="#htmlSaveFile">htmlSaveFile</a> (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur); 45int <a href="#htmlSaveFileEnc">htmlSaveFileEnc</a> (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding); 46int <a href="#htmlSaveFileFormat">htmlSaveFileFormat</a> (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding, <br> int format); 47int <a href="#htmlSetMetaEncoding">htmlSetMetaEncoding</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * encoding); 48</pre> 49</div> 50<div class="refsect1" lang="en"><h2>Description</h2></div> 51<div class="refsect1" lang="en"> 52<h2>Details</h2> 53<div class="refsect2" lang="en"> 54<div class="refsect2" lang="en"> 55<h3> 56<a name="HTML_COMMENT_NODE">Macro </a>HTML_COMMENT_NODE</h3> 57<pre class="programlisting">#define <a href="#HTML_COMMENT_NODE">HTML_COMMENT_NODE</a>; 58</pre> 59<p>Macro. A <a href="libxml2-SAX.html#comment">comment</a> in a HTML document is really implemented the same way as a <a href="libxml2-SAX.html#comment">comment</a> in an XML document.</p> 60</div> 61<hr> 62<div class="refsect2" lang="en"> 63<h3> 64<a name="HTML_ENTITY_REF_NODE">Macro </a>HTML_ENTITY_REF_NODE</h3> 65<pre class="programlisting">#define <a href="#HTML_ENTITY_REF_NODE">HTML_ENTITY_REF_NODE</a>; 66</pre> 67<p>Macro. An entity <a href="libxml2-SAX.html#reference">reference</a> in a HTML document is really implemented the same way as an entity <a href="libxml2-SAX.html#reference">reference</a> in an XML document.</p> 68</div> 69<hr> 70<div class="refsect2" lang="en"> 71<h3> 72<a name="HTML_PI_NODE">Macro </a>HTML_PI_NODE</h3> 73<pre class="programlisting">#define <a href="#HTML_PI_NODE">HTML_PI_NODE</a>; 74</pre> 75<p>Macro. A processing instruction in a HTML document is really implemented the same way as a processing instruction in an XML document.</p> 76</div> 77<hr> 78<div class="refsect2" lang="en"> 79<h3> 80<a name="HTML_PRESERVE_NODE">Macro </a>HTML_PRESERVE_NODE</h3> 81<pre class="programlisting">#define <a href="#HTML_PRESERVE_NODE">HTML_PRESERVE_NODE</a>; 82</pre> 83<p>Macro. A preserved node in a HTML document is really implemented the same way as a CDATA section in an XML document.</p> 84</div> 85<hr> 86<div class="refsect2" lang="en"> 87<h3> 88<a name="HTML_TEXT_NODE">Macro </a>HTML_TEXT_NODE</h3> 89<pre class="programlisting">#define <a href="#HTML_TEXT_NODE">HTML_TEXT_NODE</a>; 90</pre> 91<p>Macro. A text node in a HTML document is really implemented the same way as a text node in an XML document.</p> 92</div> 93<hr> 94<div class="refsect2" lang="en"> 95<h3> 96<a name="htmlDocContentDumpFormatOutput"></a>htmlDocContentDumpFormatOutput ()</h3> 97<pre class="programlisting">void htmlDocContentDumpFormatOutput (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding, <br> int format)<br> 98</pre> 99<p>Dump an HTML document.</p> 100<div class="variablelist"><table border="0"> 101<col align="left"> 102<tbody> 103<tr> 104<td><span class="term"><i><tt>buf</tt></i>:</span></td> 105<td>the HTML buffer output</td> 106</tr> 107<tr> 108<td><span class="term"><i><tt>cur</tt></i>:</span></td> 109<td>the document</td> 110</tr> 111<tr> 112<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 113<td>the encoding string (unused)</td> 114</tr> 115<tr> 116<td><span class="term"><i><tt>format</tt></i>:</span></td> 117<td>should formatting spaces been added</td> 118</tr> 119</tbody> 120</table></div> 121</div> 122<hr> 123<div class="refsect2" lang="en"> 124<h3> 125<a name="htmlDocContentDumpOutput"></a>htmlDocContentDumpOutput ()</h3> 126<pre class="programlisting">void htmlDocContentDumpOutput (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding)<br> 127</pre> 128<p>Dump an HTML document. Formatting return/spaces are added.</p> 129<div class="variablelist"><table border="0"> 130<col align="left"> 131<tbody> 132<tr> 133<td><span class="term"><i><tt>buf</tt></i>:</span></td> 134<td>the HTML buffer output</td> 135</tr> 136<tr> 137<td><span class="term"><i><tt>cur</tt></i>:</span></td> 138<td>the document</td> 139</tr> 140<tr> 141<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 142<td>the encoding string (unused)</td> 143</tr> 144</tbody> 145</table></div> 146</div> 147<hr> 148<div class="refsect2" lang="en"> 149<h3> 150<a name="htmlDocDump"></a>htmlDocDump ()</h3> 151<pre class="programlisting">int htmlDocDump (FILE * f, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur)<br> 152</pre> 153<p>Dump an HTML document to an open FILE.</p> 154<div class="variablelist"><table border="0"> 155<col align="left"> 156<tbody> 157<tr> 158<td><span class="term"><i><tt>f</tt></i>:</span></td> 159<td>the FILE*</td> 160</tr> 161<tr> 162<td><span class="term"><i><tt>cur</tt></i>:</span></td> 163<td>the document</td> 164</tr> 165<tr> 166<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 167<td>the number of byte written or -1 in case of failure.</td> 168</tr> 169</tbody> 170</table></div> 171</div> 172<hr> 173<div class="refsect2" lang="en"> 174<h3> 175<a name="htmlDocDumpMemory"></a>htmlDocDumpMemory ()</h3> 176<pre class="programlisting">void htmlDocDumpMemory (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** mem, <br> int * size)<br> 177</pre> 178<p>Dump an HTML document in memory and return the <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * and it's size. It's up to the caller to free the memory.</p> 179<div class="variablelist"><table border="0"> 180<col align="left"> 181<tbody> 182<tr> 183<td><span class="term"><i><tt>cur</tt></i>:</span></td> 184<td>the document</td> 185</tr> 186<tr> 187<td><span class="term"><i><tt>mem</tt></i>:</span></td> 188<td>OUT: the memory pointer</td> 189</tr> 190<tr> 191<td><span class="term"><i><tt>size</tt></i>:</span></td> 192<td>OUT: the memory length</td> 193</tr> 194</tbody> 195</table></div> 196</div> 197<hr> 198<div class="refsect2" lang="en"> 199<h3> 200<a name="htmlDocDumpMemoryFormat"></a>htmlDocDumpMemoryFormat ()</h3> 201<pre class="programlisting">void htmlDocDumpMemoryFormat (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** mem, <br> int * size, <br> int format)<br> 202</pre> 203<p>Dump an HTML document in memory and return the <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * and it's size. It's up to the caller to free the memory.</p> 204<div class="variablelist"><table border="0"> 205<col align="left"> 206<tbody> 207<tr> 208<td><span class="term"><i><tt>cur</tt></i>:</span></td> 209<td>the document</td> 210</tr> 211<tr> 212<td><span class="term"><i><tt>mem</tt></i>:</span></td> 213<td>OUT: the memory pointer</td> 214</tr> 215<tr> 216<td><span class="term"><i><tt>size</tt></i>:</span></td> 217<td>OUT: the memory length</td> 218</tr> 219<tr> 220<td><span class="term"><i><tt>format</tt></i>:</span></td> 221<td>should formatting spaces been added</td> 222</tr> 223</tbody> 224</table></div> 225</div> 226<hr> 227<div class="refsect2" lang="en"> 228<h3> 229<a name="htmlGetMetaEncoding"></a>htmlGetMetaEncoding ()</h3> 230<pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * htmlGetMetaEncoding (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc)<br> 231</pre> 232<p>Encoding definition lookup in the Meta tags</p> 233<div class="variablelist"><table border="0"> 234<col align="left"> 235<tbody> 236<tr> 237<td><span class="term"><i><tt>doc</tt></i>:</span></td> 238<td>the document</td> 239</tr> 240<tr> 241<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 242<td>the current encoding as flagged in the HTML source</td> 243</tr> 244</tbody> 245</table></div> 246</div> 247<hr> 248<div class="refsect2" lang="en"> 249<h3> 250<a name="htmlIsBooleanAttr"></a>htmlIsBooleanAttr ()</h3> 251<pre class="programlisting">int htmlIsBooleanAttr (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br> 252</pre> 253<p>Determine if a given <a href="libxml2-SAX.html#attribute">attribute</a> is a boolean <a href="libxml2-SAX.html#attribute">attribute</a>.</p> 254<div class="variablelist"><table border="0"> 255<col align="left"> 256<tbody> 257<tr> 258<td><span class="term"><i><tt>name</tt></i>:</span></td> 259<td>the name of the <a href="libxml2-SAX.html#attribute">attribute</a> to check</td> 260</tr> 261<tr> 262<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 263<td>false if the <a href="libxml2-SAX.html#attribute">attribute</a> is not boolean, true otherwise.</td> 264</tr> 265</tbody> 266</table></div> 267</div> 268<hr> 269<div class="refsect2" lang="en"> 270<h3> 271<a name="htmlNewDoc"></a>htmlNewDoc ()</h3> 272<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlNewDoc (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID)<br> 273</pre> 274<p>Creates a new HTML document</p> 275<div class="variablelist"><table border="0"> 276<col align="left"> 277<tbody> 278<tr> 279<td><span class="term"><i><tt>URI</tt></i>:</span></td> 280<td>URI for the dtd, or NULL</td> 281</tr> 282<tr> 283<td><span class="term"><i><tt>ExternalID</tt></i>:</span></td> 284<td>the external ID of the DTD, or NULL</td> 285</tr> 286<tr> 287<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 288<td>a new document</td> 289</tr> 290</tbody> 291</table></div> 292</div> 293<hr> 294<div class="refsect2" lang="en"> 295<h3> 296<a name="htmlNewDocNoDtD"></a>htmlNewDocNoDtD ()</h3> 297<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlNewDocNoDtD (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID)<br> 298</pre> 299<p>Creates a new HTML document without a DTD node if @URI and @ExternalID are NULL</p> 300<div class="variablelist"><table border="0"> 301<col align="left"> 302<tbody> 303<tr> 304<td><span class="term"><i><tt>URI</tt></i>:</span></td> 305<td>URI for the dtd, or NULL</td> 306</tr> 307<tr> 308<td><span class="term"><i><tt>ExternalID</tt></i>:</span></td> 309<td>the external ID of the DTD, or NULL</td> 310</tr> 311<tr> 312<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 313<td>a new document, do not initialize the DTD if not provided</td> 314</tr> 315</tbody> 316</table></div> 317</div> 318<hr> 319<div class="refsect2" lang="en"> 320<h3> 321<a name="htmlNodeDump"></a>htmlNodeDump ()</h3> 322<pre class="programlisting">int htmlNodeDump (<a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur)<br> 323</pre> 324<p>Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added.</p> 325<div class="variablelist"><table border="0"> 326<col align="left"> 327<tbody> 328<tr> 329<td><span class="term"><i><tt>buf</tt></i>:</span></td> 330<td>the HTML buffer output</td> 331</tr> 332<tr> 333<td><span class="term"><i><tt>doc</tt></i>:</span></td> 334<td>the document</td> 335</tr> 336<tr> 337<td><span class="term"><i><tt>cur</tt></i>:</span></td> 338<td>the current node</td> 339</tr> 340<tr> 341<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 342<td>the number of byte written or -1 in case of error</td> 343</tr> 344</tbody> 345</table></div> 346</div> 347<hr> 348<div class="refsect2" lang="en"> 349<h3> 350<a name="htmlNodeDumpFile"></a>htmlNodeDumpFile ()</h3> 351<pre class="programlisting">void htmlNodeDumpFile (FILE * out, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur)<br> 352</pre> 353<p>Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added.</p> 354<div class="variablelist"><table border="0"> 355<col align="left"> 356<tbody> 357<tr> 358<td><span class="term"><i><tt>out</tt></i>:</span></td> 359<td>the FILE pointer</td> 360</tr> 361<tr> 362<td><span class="term"><i><tt>doc</tt></i>:</span></td> 363<td>the document</td> 364</tr> 365<tr> 366<td><span class="term"><i><tt>cur</tt></i>:</span></td> 367<td>the current node</td> 368</tr> 369</tbody> 370</table></div> 371</div> 372<hr> 373<div class="refsect2" lang="en"> 374<h3> 375<a name="htmlNodeDumpFileFormat"></a>htmlNodeDumpFileFormat ()</h3> 376<pre class="programlisting">int htmlNodeDumpFileFormat (FILE * out, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding, <br> int format)<br> 377</pre> 378<p>Dump an HTML node, recursive behaviour,children are printed too. TODO: if encoding == NULL try to save in the doc encoding</p> 379<div class="variablelist"><table border="0"> 380<col align="left"> 381<tbody> 382<tr> 383<td><span class="term"><i><tt>out</tt></i>:</span></td> 384<td>the FILE pointer</td> 385</tr> 386<tr> 387<td><span class="term"><i><tt>doc</tt></i>:</span></td> 388<td>the document</td> 389</tr> 390<tr> 391<td><span class="term"><i><tt>cur</tt></i>:</span></td> 392<td>the current node</td> 393</tr> 394<tr> 395<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 396<td>the document encoding</td> 397</tr> 398<tr> 399<td><span class="term"><i><tt>format</tt></i>:</span></td> 400<td>should formatting spaces been added</td> 401</tr> 402<tr> 403<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 404<td>the number of byte written or -1 in case of failure.</td> 405</tr> 406</tbody> 407</table></div> 408</div> 409<hr> 410<div class="refsect2" lang="en"> 411<h3> 412<a name="htmlNodeDumpFormatOutput"></a>htmlNodeDumpFormatOutput ()</h3> 413<pre class="programlisting">void htmlNodeDumpFormatOutput (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding, <br> int format)<br> 414</pre> 415<p>Dump an HTML node, recursive behaviour,children are printed too.</p> 416<div class="variablelist"><table border="0"> 417<col align="left"> 418<tbody> 419<tr> 420<td><span class="term"><i><tt>buf</tt></i>:</span></td> 421<td>the HTML buffer output</td> 422</tr> 423<tr> 424<td><span class="term"><i><tt>doc</tt></i>:</span></td> 425<td>the document</td> 426</tr> 427<tr> 428<td><span class="term"><i><tt>cur</tt></i>:</span></td> 429<td>the current node</td> 430</tr> 431<tr> 432<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 433<td>the encoding string (unused)</td> 434</tr> 435<tr> 436<td><span class="term"><i><tt>format</tt></i>:</span></td> 437<td>should formatting spaces been added</td> 438</tr> 439</tbody> 440</table></div> 441</div> 442<hr> 443<div class="refsect2" lang="en"> 444<h3> 445<a name="htmlNodeDumpOutput"></a>htmlNodeDumpOutput ()</h3> 446<pre class="programlisting">void htmlNodeDumpOutput (<a href="libxml2-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br> const char * encoding)<br> 447</pre> 448<p>Dump an HTML node, recursive behaviour,children are printed too, and formatting returns/spaces are added.</p> 449<div class="variablelist"><table border="0"> 450<col align="left"> 451<tbody> 452<tr> 453<td><span class="term"><i><tt>buf</tt></i>:</span></td> 454<td>the HTML buffer output</td> 455</tr> 456<tr> 457<td><span class="term"><i><tt>doc</tt></i>:</span></td> 458<td>the document</td> 459</tr> 460<tr> 461<td><span class="term"><i><tt>cur</tt></i>:</span></td> 462<td>the current node</td> 463</tr> 464<tr> 465<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 466<td>the encoding string (unused)</td> 467</tr> 468</tbody> 469</table></div> 470</div> 471<hr> 472<div class="refsect2" lang="en"> 473<h3> 474<a name="htmlSaveFile"></a>htmlSaveFile ()</h3> 475<pre class="programlisting">int htmlSaveFile (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur)<br> 476</pre> 477<p>Dump an HTML document to a file. If @filename is "-" the stdout file is used.</p> 478<div class="variablelist"><table border="0"> 479<col align="left"> 480<tbody> 481<tr> 482<td><span class="term"><i><tt>filename</tt></i>:</span></td> 483<td>the filename (or URL)</td> 484</tr> 485<tr> 486<td><span class="term"><i><tt>cur</tt></i>:</span></td> 487<td>the document</td> 488</tr> 489<tr> 490<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 491<td>the number of byte written or -1 in case of failure.</td> 492</tr> 493</tbody> 494</table></div> 495</div> 496<hr> 497<div class="refsect2" lang="en"> 498<h3> 499<a name="htmlSaveFileEnc"></a>htmlSaveFileEnc ()</h3> 500<pre class="programlisting">int htmlSaveFileEnc (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding)<br> 501</pre> 502<p>Dump an HTML document to a file using a given encoding and formatting returns/spaces are added.</p> 503<div class="variablelist"><table border="0"> 504<col align="left"> 505<tbody> 506<tr> 507<td><span class="term"><i><tt>filename</tt></i>:</span></td> 508<td>the filename</td> 509</tr> 510<tr> 511<td><span class="term"><i><tt>cur</tt></i>:</span></td> 512<td>the document</td> 513</tr> 514<tr> 515<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 516<td>the document encoding</td> 517</tr> 518<tr> 519<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 520<td>the number of byte written or -1 in case of failure.</td> 521</tr> 522</tbody> 523</table></div> 524</div> 525<hr> 526<div class="refsect2" lang="en"> 527<h3> 528<a name="htmlSaveFileFormat"></a>htmlSaveFileFormat ()</h3> 529<pre class="programlisting">int htmlSaveFileFormat (const char * filename, <br> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br> const char * encoding, <br> int format)<br> 530</pre> 531<p>Dump an HTML document to a file using a given encoding.</p> 532<div class="variablelist"><table border="0"> 533<col align="left"> 534<tbody> 535<tr> 536<td><span class="term"><i><tt>filename</tt></i>:</span></td> 537<td>the filename</td> 538</tr> 539<tr> 540<td><span class="term"><i><tt>cur</tt></i>:</span></td> 541<td>the document</td> 542</tr> 543<tr> 544<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 545<td>the document encoding</td> 546</tr> 547<tr> 548<td><span class="term"><i><tt>format</tt></i>:</span></td> 549<td>should formatting spaces been added</td> 550</tr> 551<tr> 552<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 553<td>the number of byte written or -1 in case of failure.</td> 554</tr> 555</tbody> 556</table></div> 557</div> 558<hr> 559<div class="refsect2" lang="en"> 560<h3> 561<a name="htmlSetMetaEncoding"></a>htmlSetMetaEncoding ()</h3> 562<pre class="programlisting">int htmlSetMetaEncoding (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * encoding)<br> 563</pre> 564<p>Sets the current encoding in the Meta tags NOTE: this will not change the document content encoding, just the META flag associated.</p> 565<div class="variablelist"><table border="0"> 566<col align="left"> 567<tbody> 568<tr> 569<td><span class="term"><i><tt>doc</tt></i>:</span></td> 570<td>the document</td> 571</tr> 572<tr> 573<td><span class="term"><i><tt>encoding</tt></i>:</span></td> 574<td>the encoding string</td> 575</tr> 576<tr> 577<td><span class="term"><i><tt>Returns</tt></i>:</span></td> 578<td>0 in case of success and -1 in case of error</td> 579</tr> 580</tbody> 581</table></div> 582</div> 583<hr> 584</div> 585</div> 586</body> 587</html> 588