libxml2/doc/devhelp/libxml2-HTMLparser.html
2025-03-27 15:17:22 +01:00

1499 lines
67 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTMLparser: interface for an HTML 4.0 non-verifying parser</title>
<meta name="generator" content="Libxml2 devhelp stylesheet">
<link rel="start" href="index.html" title="libxml2 Reference Manual">
<link rel="up" href="general.html" title="API">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="API">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="u" href="general.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<td><a accesskey="n" href="libxml2-HTMLtree.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
<th width="100%" align="center">libxml2 Reference Manual</th>
</tr></table>
<h2><span class="refentrytitle">HTMLparser</span></h2>
<p>HTMLparser - interface for an HTML 4.0 non-verifying parser</p>
<p>this module implements an HTML 4.0 non-verifying parser with API compatible with the XML parser ones. It should be able to parse "real world" HTML, even if severely broken from a specification point of view. </p>
<p>Author(s): Daniel Veillard </p>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">#define <a href="#UTF8ToHtml">UTF8ToHtml</a>;
#define <a href="#htmlDefaultSubelement">htmlDefaultSubelement</a>(elt);
#define <a href="#htmlElementAllowedHereDesc">htmlElementAllowedHereDesc</a>(parent, elt);
#define <a href="#htmlRequiredAttrs">htmlRequiredAttrs</a>(elt);
typedef <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> <a href="#htmlDocPtr">htmlDocPtr</a>;
typedef struct _htmlElemDesc <a href="#htmlElemDesc">htmlElemDesc</a>;
typedef <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * <a href="#htmlElemDescPtr">htmlElemDescPtr</a>;
typedef struct _htmlEntityDesc <a href="#htmlEntityDesc">htmlEntityDesc</a>;
typedef <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a href="#htmlEntityDescPtr">htmlEntityDescPtr</a>;
typedef <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> <a href="#htmlNodePtr">htmlNodePtr</a>;
typedef <a href="libxml2-tree.html#xmlParserCtxt">xmlParserCtxt</a> <a href="#htmlParserCtxt">htmlParserCtxt</a>;
typedef <a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> <a href="#htmlParserCtxtPtr">htmlParserCtxtPtr</a>;
typedef <a href="libxml2-tree.html#xmlParserInput">xmlParserInput</a> <a href="#htmlParserInput">htmlParserInput</a>;
typedef <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> <a href="#htmlParserInputPtr">htmlParserInputPtr</a>;
typedef <a href="libxml2-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> <a href="#htmlParserNodeInfo">htmlParserNodeInfo</a>;
typedef enum <a href="#htmlParserOption">htmlParserOption</a>;
typedef <a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> <a href="#htmlSAXHandler">htmlSAXHandler</a>;
typedef <a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> <a href="#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a>;
typedef enum <a href="#htmlStatus">htmlStatus</a>;
<a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> <a href="#htmlAttrAllowed">htmlAttrAllowed</a> (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * attr, <br> int legacy);
int <a href="#htmlAutoCloseTag">htmlAutoCloseTag</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreateFileParserCtxt">htmlCreateFileParserCtxt</a> (const char * filename, <br> const char * encoding);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreateMemoryParserCtxt">htmlCreateMemoryParserCtxt</a> (const char * buffer, <br> int size);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlCreatePushParserCtxt">htmlCreatePushParserCtxt</a> (<a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * user_data, <br> const char * chunk, <br> int size, <br> const char * filename, <br> <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtParseDocument">htmlCtxtParseDocument</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> input);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadDoc">htmlCtxtReadDoc</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br> const char * URL, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadFd">htmlCtxtReadFd</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> int fd, <br> const char * URL, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadFile">htmlCtxtReadFile</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * filename, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadIO">htmlCtxtReadIO</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> <a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br> <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br> void * ioctx, <br> const char * URL, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlCtxtReadMemory">htmlCtxtReadMemory</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * buffer, <br> int size, <br> const char * URL, <br> const char * encoding, <br> int options);
void <a href="#htmlCtxtReset">htmlCtxtReset</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
int <a href="#htmlCtxtSetOptions">htmlCtxtSetOptions</a> (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br> int options);
int <a href="#htmlCtxtUseOptions">htmlCtxtUseOptions</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> int options);
int <a href="#htmlElementAllowedHere">htmlElementAllowedHere</a> (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * parent, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * elt);
<a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> <a href="#htmlElementStatusHere">htmlElementStatusHere</a> (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * parent, <br> const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt);
int <a href="#htmlEncodeEntities">htmlEncodeEntities</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen, <br> int quoteChar);
const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a href="#htmlEntityLookup">htmlEntityLookup</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a href="#htmlEntityValueLookup">htmlEntityValueLookup</a> (unsigned int value);
void <a href="#htmlFreeParserCtxt">htmlFreeParserCtxt</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
int <a href="#htmlHandleOmittedElem">htmlHandleOmittedElem</a> (int val);
void <a href="#htmlInitAutoClose">htmlInitAutoClose</a> (void);
int <a href="#htmlIsAutoClosed">htmlIsAutoClosed</a> (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
int <a href="#htmlIsScriptAttribute">htmlIsScriptAttribute</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlNewParserCtxt">htmlNewParserCtxt</a> (void);
<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> <a href="#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> (const <a href="libxml2-HTMLparser.html#htmlSAXHandler">htmlSAXHandler</a> * sax, <br> void * userData);
<a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> <a href="#htmlNodeStatus">htmlNodeStatus</a> (<a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> node, <br> int legacy);
int <a href="#htmlParseCharRef">htmlParseCharRef</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
int <a href="#htmlParseChunk">htmlParseChunk</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * chunk, <br> int size, <br> int terminate);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlParseDoc">htmlParseDoc</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br> const char * encoding);
int <a href="#htmlParseDocument">htmlParseDocument</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
void <a href="#htmlParseElement">htmlParseElement</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * <a href="#htmlParseEntityRef">htmlParseEntityRef</a> (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** str);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlParseFile">htmlParseFile</a> (const char * filename, <br> const char * encoding);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlReadDoc">htmlReadDoc</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br> const char * url, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlReadFd">htmlReadFd</a> (int fd, <br> const char * url, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlReadFile">htmlReadFile</a> (const char * filename, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlReadIO">htmlReadIO</a> (<a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br> <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br> void * ioctx, <br> const char * url, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlReadMemory">htmlReadMemory</a> (const char * buffer, <br> int size, <br> const char * url, <br> const char * encoding, <br> int options);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlSAXParseDoc">htmlSAXParseDoc</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br> const char * encoding, <br> <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * userData);
<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> <a href="#htmlSAXParseFile">htmlSAXParseFile</a> (const char * filename, <br> const char * encoding, <br> <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * userData);
const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * <a href="#htmlTagLookup">htmlTagLookup</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * tag);
int <a href="#htmlUTF8ToHtml">htmlUTF8ToHtml</a> (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen);
</pre>
</div>
<div class="refsect1" lang="en"><h2>Description</h2></div>
<div class="refsect1" lang="en">
<h2>Details</h2>
<div class="refsect2" lang="en">
<div class="refsect2" lang="en">
<h3>
<a name="UTF8ToHtml">Macro </a>UTF8ToHtml</h3>
<pre class="programlisting">#define <a href="#UTF8ToHtml">UTF8ToHtml</a>;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlDefaultSubelement">Macro </a>htmlDefaultSubelement</h3>
<pre class="programlisting">#define <a href="#htmlDefaultSubelement">htmlDefaultSubelement</a>(elt);
</pre>
<p>Returns the default subelement for this element</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlElementAllowedHereDesc">Macro </a>htmlElementAllowedHereDesc</h3>
<pre class="programlisting">#define <a href="#htmlElementAllowedHereDesc">htmlElementAllowedHereDesc</a>(parent, elt);
</pre>
<p>Checks whether an HTML element description may be a direct child of the specified element. Returns 1 if allowed; 0 otherwise.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>parent</tt></i>:</span></td>
<td>HTML parent element</td>
</tr>
<tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlRequiredAttrs">Macro </a>htmlRequiredAttrs</h3>
<pre class="programlisting">#define <a href="#htmlRequiredAttrs">htmlRequiredAttrs</a>(elt);
</pre>
<p>Returns the attributes required for the specified element.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlDocPtr">Typedef </a>htmlDocPtr</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> htmlDocPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlElemDesc">Structure </a>htmlElemDesc</h3>
<pre class="programlisting">struct _htmlElemDesc {
const char * name
char startTag
char endTag
char saveEndTag
char empty
char depr
char dtd
char isinline
const char * desc
const char ** subelts
const char * defaultsubelt
const char ** attrs_opt
const char ** attrs_depr
const char ** attrs_req
int dataMode
} htmlElemDesc;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlElemDescPtr">Typedef </a>htmlElemDescPtr</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * htmlElemDescPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlEntityDesc">Structure </a>htmlEntityDesc</h3>
<pre class="programlisting">struct _htmlEntityDesc {
unsigned int value
const char * name
const char * desc
} htmlEntityDesc;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlEntityDescPtr">Typedef </a>htmlEntityDescPtr</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * htmlEntityDescPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlNodePtr">Typedef </a>htmlNodePtr</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> htmlNodePtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserCtxt">Typedef </a>htmlParserCtxt</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlParserCtxt">xmlParserCtxt</a> htmlParserCtxt;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserCtxtPtr">Typedef </a>htmlParserCtxtPtr</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> htmlParserCtxtPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserInput">Typedef </a>htmlParserInput</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlParserInput">xmlParserInput</a> htmlParserInput;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserInputPtr">Typedef </a>htmlParserInputPtr</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> htmlParserInputPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserNodeInfo">Typedef </a>htmlParserNodeInfo</h3>
<pre class="programlisting"><a href="libxml2-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> htmlParserNodeInfo;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParserOption">Enum </a>htmlParserOption</h3>
<pre class="programlisting">enum <a href="#htmlParserOption">htmlParserOption</a> {
<a name="HTML_PARSE_RECOVER">HTML_PARSE_RECOVER</a> = 1 /* No effect */
<a name="HTML_PARSE_HTML5">HTML_PARSE_HTML5</a> = 2 /* HTML5 support */
<a name="HTML_PARSE_NODEFDTD">HTML_PARSE_NODEFDTD</a> = 4 /* do not default a doctype if not found */
<a name="HTML_PARSE_NOERROR">HTML_PARSE_NOERROR</a> = 32 /* suppress error reports */
<a name="HTML_PARSE_NOWARNING">HTML_PARSE_NOWARNING</a> = 64 /* suppress warning reports */
<a name="HTML_PARSE_PEDANTIC">HTML_PARSE_PEDANTIC</a> = 128 /* No effect */
<a name="HTML_PARSE_NOBLANKS">HTML_PARSE_NOBLANKS</a> = 256 /* remove blank nodes */
<a name="HTML_PARSE_NONET">HTML_PARSE_NONET</a> = 2048 /* No effect */
<a name="HTML_PARSE_NOIMPLIED">HTML_PARSE_NOIMPLIED</a> = 8192 /* Do not add implied html/body... elements */
<a name="HTML_PARSE_COMPACT">HTML_PARSE_COMPACT</a> = 65536 /* compact small text nodes */
<a name="HTML_PARSE_HUGE">HTML_PARSE_HUGE</a> = 524288 /* relax any hardcoded limit from the parser */
<a name="HTML_PARSE_IGNORE_ENC">HTML_PARSE_IGNORE_ENC</a> = 2097152 /* ignore internal document encoding hint */
<a name="HTML_PARSE_BIG_LINES">HTML_PARSE_BIG_LINES</a> = 4194304 /* Store big lines numbers in text PSVI field */
};
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlSAXHandler">Typedef </a>htmlSAXHandler</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> htmlSAXHandler;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlSAXHandlerPtr">Typedef </a>htmlSAXHandlerPtr</h3>
<pre class="programlisting"><a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> htmlSAXHandlerPtr;
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlStatus">Enum </a>htmlStatus</h3>
<pre class="programlisting">enum <a href="#htmlStatus">htmlStatus</a> {
<a name="HTML_NA">HTML_NA</a> = 0 /* something we don't check at all */
<a name="HTML_INVALID">HTML_INVALID</a> = 1
<a name="HTML_DEPRECATED">HTML_DEPRECATED</a> = 2
<a name="HTML_VALID">HTML_VALID</a> = 4
<a name="HTML_REQUIRED">HTML_REQUIRED</a> = 12 /* VALID bit set so ( &amp; HTML_VALID ) is TRUE */
};
</pre>
<p></p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlDefaultSAXHandler">Variable </a>htmlDefaultSAXHandler</h3>
<pre class="programlisting">const <a href="libxml2-parser.html#xmlSAXHandlerV1">xmlSAXHandlerV1</a> htmlDefaultSAXHandler;
</pre>
<p>DEPRECATED: This handler is unused and will be removed from future versions. Default old SAX v1 handler for HTML, builds the DOM tree</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlAttrAllowed"></a>htmlAttrAllowed ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> htmlAttrAllowed (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * attr, <br> int legacy)<br>
</pre>
<p>DEPRECATED: Don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr>
<tr>
<td><span class="term"><i><tt>attr</tt></i>:</span></td>
<td>HTML attribute</td>
</tr>
<tr>
<td><span class="term"><i><tt>legacy</tt></i>:</span></td>
<td>whether to allow deprecated attributes</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td><a href="libxml2-HTMLparser.html#HTML_VALID">HTML_VALID</a></td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlAutoCloseTag"></a>htmlAutoCloseTag ()</h3>
<pre class="programlisting">int htmlAutoCloseTag (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem)<br>
</pre>
<p>DEPRECATED: Internal function, don't use. The HTML DTD allows a tag to implicitly close other tags. The list is kept in htmlStartClose array. This function checks if the element or one of it's children would autoclose the given tag.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>doc</tt></i>:</span></td>
<td>the HTML document</td>
</tr>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>The tag name</td>
</tr>
<tr>
<td><span class="term"><i><tt>elem</tt></i>:</span></td>
<td>the HTML element</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>1 if autoclose, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreateFileParserCtxt"></a>htmlCreateFileParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreateFileParserCtxt (const char * filename, <br> const char * encoding)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadFile">htmlCtxtReadFile</a>. Create a parser context to read from a file. A non-NULL encoding overrides encoding declarations in the document. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the filename</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>optional encoding</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the new parser context or NULL if a memory allocation failed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreateMemoryParserCtxt"></a>htmlCreateMemoryParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreateMemoryParserCtxt (const char * buffer, <br> int size)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadMemory">htmlCtxtReadMemory</a>. Create a parser context for an HTML in-memory document. The input buffer must not contain any terminating null bytes.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>buffer</tt></i>:</span></td>
<td>a pointer to a char array</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>the size of the array</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the new parser context or NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCreatePushParserCtxt"></a>htmlCreatePushParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlCreatePushParserCtxt (<a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * user_data, <br> const char * chunk, <br> int size, <br> const char * filename, <br> <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc)<br>
</pre>
<p>Create a parser context for using the HTML parser in push mode.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>sax</tt></i>:</span></td>
<td>a SAX handler (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>user_data</tt></i>:</span></td>
<td>The user data returned on SAX callbacks (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>chunk</tt></i>:</span></td>
<td>a pointer to an array of chars (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>number of chars in the array</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>enc</tt></i>:</span></td>
<td>encoding (deprecated, pass XML_CHAR_ENCODING_NONE)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the new parser context or NULL if a memory allocation failed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtParseDocument"></a>htmlCtxtParseDocument ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtParseDocument (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> input)<br>
</pre>
<p>Parse an HTML document and return the resulting document tree. Available since 2.13.0.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>input</tt></i>:</span></td>
<td>parser input</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree or NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReadDoc"></a>htmlCtxtReadDoc ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtReadDoc (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br> const char * URL, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Parse an HTML in-memory document and build a tree. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>str</tt></i>:</span></td>
<td>a pointer to a zero terminated string</td>
</tr>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReadFd"></a>htmlCtxtReadFd ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtReadFd (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> int fd, <br> const char * URL, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Parse an HTML from a file descriptor and build a tree. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for details. NOTE that the file descriptor will not be closed when the context is freed or reset.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>fd</tt></i>:</span></td>
<td>an open file descriptor</td>
</tr>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optinal)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReadFile"></a>htmlCtxtReadFile ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtReadFile (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * filename, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Parse an HTML file from the filesystem, the network or a user-defined resource loader. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>a file or URL</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReadIO"></a>htmlCtxtReadIO ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtReadIO (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> <a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br> <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br> void * ioctx, <br> const char * URL, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Parse an HTML document from I/O functions and source and build a tree. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>ioread</tt></i>:</span></td>
<td>an I/O read function</td>
</tr>
<tr>
<td><span class="term"><i><tt>ioclose</tt></i>:</span></td>
<td>an I/O close function</td>
</tr>
<tr>
<td><span class="term"><i><tt>ioctx</tt></i>:</span></td>
<td>an I/O handler</td>
</tr>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>the base URL to use for the document</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOption(s)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReadMemory"></a>htmlCtxtReadMemory ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlCtxtReadMemory (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * buffer, <br> int size, <br> const char * URL, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Parse an HTML in-memory document and build a tree. The input buffer must not contain any terminating null bytes. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>buffer</tt></i>:</span></td>
<td>a pointer to a char array</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>the size of the array</td>
</tr>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optinal)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtReset"></a>htmlCtxtReset ()</h3>
<pre class="programlisting">void htmlCtxtReset (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
</pre>
<p>Reset a parser context</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtSetOptions"></a>htmlCtxtSetOptions ()</h3>
<pre class="programlisting">int htmlCtxtSetOptions (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br> int options)<br>
</pre>
<p>Applies the options to the parser context. Unset options are cleared. Available since 2.14.0. With older versions, you can use <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a>. <a href="libxml2-HTMLparser.html#HTML_PARSE_RECOVER">HTML_PARSE_RECOVER</a> No effect as of 2.14.0. <a href="libxml2-HTMLparser.html#HTML_PARSE_HTML5">HTML_PARSE_HTML5</a> Make the tokenizer emit a SAX callback for each token. This results in unbalanced invocations of startElement and endElement. For now, this is only usable with custom SAX callbacks. <a href="libxml2-HTMLparser.html#HTML_PARSE_NODEFDTD">HTML_PARSE_NODEFDTD</a> Do not default to a doctype if none was found. <a href="libxml2-HTMLparser.html#HTML_PARSE_NOERROR">HTML_PARSE_NOERROR</a> Disable error and warning reports to the error handlers. Errors are still accessible with <a href="libxml2-xmlerror.html#xmlCtxtGetLastError">xmlCtxtGetLastError</a>. <a href="libxml2-HTMLparser.html#HTML_PARSE_NOWARNING">HTML_PARSE_NOWARNING</a> Disable warning reports. <a href="libxml2-HTMLparser.html#HTML_PARSE_PEDANTIC">HTML_PARSE_PEDANTIC</a> No effect. <a href="libxml2-HTMLparser.html#HTML_PARSE_NOBLANKS">HTML_PARSE_NOBLANKS</a> Remove some text nodes containing only whitespace from the result document. Which nodes are removed depends on a conservative heuristic. The reindenting feature of the serialization code relies on this option to be set when parsing. Use of this option is DISCOURAGED. <a href="libxml2-HTMLparser.html#HTML_PARSE_NONET">HTML_PARSE_NONET</a> No effect. <a href="libxml2-HTMLparser.html#HTML_PARSE_NOIMPLIED">HTML_PARSE_NOIMPLIED</a> Do not add implied html, head or body elements. <a href="libxml2-HTMLparser.html#HTML_PARSE_COMPACT">HTML_PARSE_COMPACT</a> Store small strings directly in the node struct to save memory. <a href="libxml2-HTMLparser.html#HTML_PARSE_HUGE">HTML_PARSE_HUGE</a> Relax some internal limits. Available since 2.14.0. Use <a href="libxml2-parser.html#XML_PARSE_HUGE">XML_PARSE_HUGE</a> works with older versions. Maximum size of text nodes, tags, comments, CDATA sections normal: 10M huge: 1B Maximum size of names, system literals, pubid literals normal: 50K huge: 10M Maximum nesting depth of elements normal: 256 huge: 2048 <a href="libxml2-HTMLparser.html#HTML_PARSE_IGNORE_ENC">HTML_PARSE_IGNORE_ENC</a> Ignore the encoding in the HTML declaration. This option is mostly unneeded these days. The only effect is to enforce UTF-8 decoding of ASCII-like data. <a href="libxml2-HTMLparser.html#HTML_PARSE_BIG_LINES">HTML_PARSE_BIG_LINES</a> Enable reporting of line numbers larger than 65535. Available since 2.14.0.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a bitmask of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a> values</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 in case of success, the set of unknown or unimplemented options in case of error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlCtxtUseOptions"></a>htmlCtxtUseOptions ()</h3>
<pre class="programlisting">int htmlCtxtUseOptions (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> int options)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlCtxtSetOptions">htmlCtxtSetOptions</a>. Applies the options to the parser context. The following options are never cleared and can only be enabled: <a href="libxml2-HTMLparser.html#HTML_PARSE_NODEFDTD">HTML_PARSE_NODEFDTD</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_NOERROR">HTML_PARSE_NOERROR</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_NOWARNING">HTML_PARSE_NOWARNING</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_NOIMPLIED">HTML_PARSE_NOIMPLIED</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_COMPACT">HTML_PARSE_COMPACT</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_HUGE">HTML_PARSE_HUGE</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_IGNORE_ENC">HTML_PARSE_IGNORE_ENC</a> <a href="libxml2-HTMLparser.html#HTML_PARSE_BIG_LINES">HTML_PARSE_BIG_LINES</a></p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOption(s)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 in case of success, the set of unknown or unimplemented options in case of error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlElementAllowedHere"></a>htmlElementAllowedHere ()</h3>
<pre class="programlisting">int htmlElementAllowedHere (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * parent, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * elt)<br>
</pre>
<p>DEPRECATED: Don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>parent</tt></i>:</span></td>
<td>HTML parent element</td>
</tr>
<tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>1</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlElementStatusHere"></a>htmlElementStatusHere ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> htmlElementStatusHere (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * parent, <br> const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt)<br>
</pre>
<p>DEPRECATED: Don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>parent</tt></i>:</span></td>
<td>HTML parent element</td>
</tr>
<tr>
<td><span class="term"><i><tt>elt</tt></i>:</span></td>
<td>HTML element</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td><a href="libxml2-HTMLparser.html#HTML_VALID">HTML_VALID</a></td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlEncodeEntities"></a>htmlEncodeEntities ()</h3>
<pre class="programlisting">int htmlEncodeEntities (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen, <br> int quoteChar)<br>
</pre>
<p>Take a block of UTF-8 chars in and try to convert it to an ASCII plus HTML entities block of chars out.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of UTF-8 chars</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>quoteChar</tt></i>:</span></td>
<td>the quote character to escape (' or ") or zero.</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 if success, -2 if the transcoding fails, or -1 otherwise The value of @inlen after return is the number of octets consumed as the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlEntityLookup"></a>htmlEntityLookup ()</h3>
<pre class="programlisting">const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * htmlEntityLookup (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
</pre>
<p>Lookup the given entity in EntitiesTable TODO: the linear scan is really ugly, an hash table is really needed.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>the entity name</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the associated <a href="libxml2-HTMLparser.html#htmlEntityDescPtr">htmlEntityDescPtr</a> if found, NULL otherwise.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlEntityValueLookup"></a>htmlEntityValueLookup ()</h3>
<pre class="programlisting">const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * htmlEntityValueLookup (unsigned int value)<br>
</pre>
<p>Lookup the given entity in EntitiesTable TODO: the linear scan is really ugly, an hash table is really needed.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>value</tt></i>:</span></td>
<td>the entity's unicode value</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the associated <a href="libxml2-HTMLparser.html#htmlEntityDescPtr">htmlEntityDescPtr</a> if found, NULL otherwise.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlFreeParserCtxt"></a>htmlFreeParserCtxt ()</h3>
<pre class="programlisting">void htmlFreeParserCtxt (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
</pre>
<p>Free all the memory used by a parser context. However the parsed document in ctxt-&gt;myDoc is not freed.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlHandleOmittedElem"></a>htmlHandleOmittedElem ()</h3>
<pre class="programlisting">int htmlHandleOmittedElem (int val)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#HTML_PARSE_NOIMPLIED">HTML_PARSE_NOIMPLIED</a> Set and return the previous value for handling HTML omitted tags.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>val</tt></i>:</span></td>
<td>int 0 or 1</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the last value for 0 for no handling, 1 for auto insertion.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlInitAutoClose"></a>htmlInitAutoClose ()</h3>
<pre class="programlisting">void htmlInitAutoClose (void)<br>
</pre>
<p>DEPRECATED: This is a no-op.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlIsAutoClosed"></a>htmlIsAutoClosed ()</h3>
<pre class="programlisting">int htmlIsAutoClosed (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br> <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem)<br>
</pre>
<p>DEPRECATED: Internal function, don't use. The HTML DTD allows a tag to implicitly close other tags. The list is kept in htmlStartClose array. This function checks if a tag is autoclosed by one of it's child</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>doc</tt></i>:</span></td>
<td>the HTML document</td>
</tr>
<tr>
<td><span class="term"><i><tt>elem</tt></i>:</span></td>
<td>the HTML element</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>1 if autoclosed, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlIsScriptAttribute"></a>htmlIsScriptAttribute ()</h3>
<pre class="programlisting">int htmlIsScriptAttribute (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
</pre>
<p>Check if an attribute is of content type Script</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>name</tt></i>:</span></td>
<td>an attribute name</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>1 is the attribute is a script 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlNewParserCtxt"></a>htmlNewParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlNewParserCtxt (void)<br>
</pre>
<p>Allocate and initialize a new HTML parser context. This can be used to parse HTML documents into DOM trees with functions like <a href="libxml2-parser.html#xmlCtxtReadFile">xmlCtxtReadFile</a> or <a href="libxml2-parser.html#xmlCtxtReadMemory">xmlCtxtReadMemory</a>. See <a href="libxml2-HTMLparser.html#htmlCtxtUseOptions">htmlCtxtUseOptions</a> for parser options. See <a href="libxml2-parser.html#xmlCtxtSetErrorHandler">xmlCtxtSetErrorHandler</a> for advanced error handling. See <a href="libxml2-HTMLparser.html#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> for custom SAX parsers.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> or NULL in case of allocation error</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlNewSAXParserCtxt"></a>htmlNewSAXParserCtxt ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> htmlNewSAXParserCtxt (const <a href="libxml2-HTMLparser.html#htmlSAXHandler">htmlSAXHandler</a> * sax, <br> void * userData)<br>
</pre>
<p>Allocate and initialize a new HTML SAX parser context. If userData is NULL, the parser context will be passed as user data. Available since 2.11.0. If you want support older versions, it's best to invoke <a href="libxml2-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a> and set ctxt-&gt;sax with struct assignment. Also see <a href="libxml2-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a>.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>sax</tt></i>:</span></td>
<td>SAX handler</td>
</tr>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>user data</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> or NULL in case of allocation error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlNodeStatus"></a>htmlNodeStatus ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a> htmlNodeStatus (<a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> node, <br> int legacy)<br>
</pre>
<p>DEPRECATED: Don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>node</tt></i>:</span></td>
<td>an <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> in a tree</td>
</tr>
<tr>
<td><span class="term"><i><tt>legacy</tt></i>:</span></td>
<td>whether to allow deprecated elements (YES is faster here for Element nodes)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td><a href="libxml2-HTMLparser.html#HTML_VALID">HTML_VALID</a></td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseCharRef"></a>htmlParseCharRef ()</h3>
<pre class="programlisting">int htmlParseCharRef (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
</pre>
<p>DEPRECATED: Internal function, don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseChunk"></a>htmlParseChunk ()</h3>
<pre class="programlisting">int htmlParseChunk (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const char * chunk, <br> int size, <br> int terminate)<br>
</pre>
<p>Parse a chunk of memory in push parser mode. Assumes that the parser context was initialized with <a href="libxml2-HTMLparser.html#htmlCreatePushParserCtxt">htmlCreatePushParserCtxt</a>. The last chunk, which will often be empty, must be marked with the @terminate flag. With the default SAX callbacks, the resulting document will be available in ctxt-&gt;myDoc. This pointer will not be freed by the library. If the document isn't well-formed, ctxt-&gt;myDoc is set to NULL.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>chunk</tt></i>:</span></td>
<td>chunk of memory</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>size of chunk in bytes</td>
</tr>
<tr>
<td><span class="term"><i><tt>terminate</tt></i>:</span></td>
<td>last chunk indicator</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an <a href="libxml2-xmlerror.html#xmlParserErrors">xmlParserErrors</a> code (0 on success).</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseDoc"></a>htmlParseDoc ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlParseDoc (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br> const char * encoding)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlReadDoc">htmlReadDoc</a>. Parse an HTML in-memory document and build a tree. This function uses deprecated global parser options.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>cur</tt></i>:</span></td>
<td>a pointer to an array of <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a>
</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseDocument"></a>htmlParseDocument ()</h3>
<pre class="programlisting">int htmlParseDocument (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
</pre>
<p>Parse an HTML document and invoke the SAX handlers. This is useful if you're only interested in custom SAX callbacks. If you want a document tree, use <a href="libxml2-HTMLparser.html#htmlCtxtParseDocument">htmlCtxtParseDocument</a>.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0, -1 in case of error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseElement"></a>htmlParseElement ()</h3>
<pre class="programlisting">void htmlParseElement (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
</pre>
<p>DEPRECATED: Internal function, don't use. parse an HTML element, this is highly recursive this is kept for compatibility with previous code versions [39] element ::= EmptyElemTag | STag content ETag [41] Attribute ::= Name Eq AttValue</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseEntityRef"></a>htmlParseEntityRef ()</h3>
<pre class="programlisting">const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> * htmlParseEntityRef (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** str)<br>
</pre>
<p>DEPRECATED: Internal function, don't use.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctxt</tt></i>:</span></td>
<td>an HTML parser context</td>
</tr>
<tr>
<td><span class="term"><i><tt>str</tt></i>:</span></td>
<td>location to store the entity name</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>NULL.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlParseFile"></a>htmlParseFile ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlParseFile (const char * filename, <br> const char * encoding)<br>
</pre>
<p>Parse an HTML file and build a tree.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the filename</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlReadDoc"></a>htmlReadDoc ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlReadDoc (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br> const char * url, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Convenience function to parse an HTML document from a zero-terminated string. See <a href="libxml2-HTMLparser.html#htmlCtxtReadDoc">htmlCtxtReadDoc</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>str</tt></i>:</span></td>
<td>a pointer to a zero terminated string</td>
</tr>
<tr>
<td><span class="term"><i><tt>url</tt></i>:</span></td>
<td>only used for error reporting (optoinal)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlReadFd"></a>htmlReadFd ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlReadFd (int fd, <br> const char * url, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Convenience function to parse an HTML document from a file descriptor. NOTE that the file descriptor will not be closed when the context is freed or reset. See <a href="libxml2-HTMLparser.html#htmlCtxtReadFd">htmlCtxtReadFd</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>fd</tt></i>:</span></td>
<td>an open file descriptor</td>
</tr>
<tr>
<td><span class="term"><i><tt>url</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlReadFile"></a>htmlReadFile ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlReadFile (const char * filename, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Convenience function to parse an HTML file from the filesystem, the network or a global user-defined resource loader. See <a href="libxml2-HTMLparser.html#htmlCtxtReadFile">htmlCtxtReadFile</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>a file or URL</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOptions</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlReadIO"></a>htmlReadIO ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlReadIO (<a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br> <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br> void * ioctx, <br> const char * url, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Convenience function to parse an HTML document from I/O functions and context. See <a href="libxml2-HTMLparser.html#htmlCtxtReadIO">htmlCtxtReadIO</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ioread</tt></i>:</span></td>
<td>an I/O read function</td>
</tr>
<tr>
<td><span class="term"><i><tt>ioclose</tt></i>:</span></td>
<td>an I/O close function (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>ioctx</tt></i>:</span></td>
<td>an I/O handler</td>
</tr>
<tr>
<td><span class="term"><i><tt>url</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOption(s)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlReadMemory"></a>htmlReadMemory ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlReadMemory (const char * buffer, <br> int size, <br> const char * url, <br> const char * encoding, <br> int options)<br>
</pre>
<p>Convenience function to parse an HTML document from memory. The input buffer must not contain any terminating null bytes. See <a href="libxml2-HTMLparser.html#htmlCtxtReadMemory">htmlCtxtReadMemory</a> for details.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>buffer</tt></i>:</span></td>
<td>a pointer to a char array</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>the size of the array</td>
</tr>
<tr>
<td><span class="term"><i><tt>url</tt></i>:</span></td>
<td>only used for error reporting (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>the document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>options</tt></i>:</span></td>
<td>a combination of htmlParserOption(s)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlSAXParseDoc"></a>htmlSAXParseDoc ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlSAXParseDoc (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br> const char * encoding, <br> <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * userData)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadDoc">htmlCtxtReadDoc</a>. Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks to handle parse events. If sax is NULL, fallback to the default DOM behavior and return a tree.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>cur</tt></i>:</span></td>
<td>a pointer to an array of <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a>
</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>a free form C string describing the HTML document encoding, or NULL</td>
</tr>
<tr>
<td><span class="term"><i><tt>sax</tt></i>:</span></td>
<td>the SAX handler block</td>
</tr>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>if using SAX, this pointer will be provided on callbacks.</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree unless SAX is NULL or the document is not well formed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlSAXParseFile"></a>htmlSAXParseFile ()</h3>
<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> htmlSAXParseFile (const char * filename, <br> const char * encoding, <br> <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br> void * userData)<br>
</pre>
<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadFile">htmlCtxtReadFile</a>. parse an HTML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the filename</td>
</tr>
<tr>
<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
<td>encoding (optional)</td>
</tr>
<tr>
<td><span class="term"><i><tt>sax</tt></i>:</span></td>
<td>the SAX handler block</td>
</tr>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>if using SAX, this pointer will be provided on callbacks.</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the resulting document tree unless SAX is NULL or the document is not well formed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlTagLookup"></a>htmlTagLookup ()</h3>
<pre class="programlisting">const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * htmlTagLookup (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * tag)<br>
</pre>
<p>Lookup the HTML tag in the ElementTable</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>tag</tt></i>:</span></td>
<td>The tag name in lowercase</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the related <a href="libxml2-HTMLparser.html#htmlElemDescPtr">htmlElemDescPtr</a> or NULL if not found.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="htmlUTF8ToHtml"></a>htmlUTF8ToHtml ()</h3>
<pre class="programlisting">int htmlUTF8ToHtml (unsigned char * out, <br> int * outlen, <br> const unsigned char * in, <br> int * inlen)<br>
</pre>
<p>Take a block of UTF-8 chars in and try to convert it to an ASCII plus HTML entities block of chars out.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>out</tt></i>:</span></td>
<td>a pointer to an array of bytes to store the result</td>
</tr>
<tr>
<td><span class="term"><i><tt>outlen</tt></i>:</span></td>
<td>the length of @out</td>
</tr>
<tr>
<td><span class="term"><i><tt>in</tt></i>:</span></td>
<td>a pointer to an array of UTF-8 chars</td>
</tr>
<tr>
<td><span class="term"><i><tt>inlen</tt></i>:</span></td>
<td>the length of @in</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 if success, -2 if the transcoding fails, or -1 otherwise The value of @inlen after return is the number of octets consumed as the return value is positive, else unpredictable. The value of @outlen after return is the number of octets consumed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
</div>
</div>
</body>
</html>