1<?xml version="1.0" encoding="UTF-8"?> 2<html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 5 <title>SAX2: SAX2 parser interface used to build the DOM tree</title> 6 <meta name="generator" content="Libxml2 devhelp stylesheet"/> 7 <link rel="start" href="index.html" title="libxml2 Reference Manual"/> 8 <link rel="up" href="general.html" title="API"/> 9 <link rel="stylesheet" href="style.css" type="text/css"/> 10 <link rel="chapter" href="general.html" title="API"/> 11 </head> 12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13 <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> 14 <tr valign="middle"> 15 <td> 16 <a accesskey="p" href="libxml2-SAX.html"> 17 <img src="left.png" width="24" height="24" border="0" alt="Prev"/> 18 </a> 19 </td> 20 <td> 21 <a accesskey="u" href="general.html"> 22 <img src="up.png" width="24" height="24" border="0" alt="Up"/> 23 </a> 24 </td> 25 <td> 26 <a accesskey="h" href="index.html"> 27 <img src="home.png" width="24" height="24" border="0" alt="Home"/> 28 </a> 29 </td> 30 <td> 31 <a accesskey="n" href="libxml2-c14n.html"> 32 <img src="right.png" width="24" height="24" border="0" alt="Next"/> 33 </a> 34 </td> 35 <th width="100%" align="center">libxml2 Reference Manual</th> 36 </tr> 37 </table> 38 <h2> 39 <span class="refentrytitle">SAX2</span> 40 </h2> 41 <p>SAX2 - SAX2 parser interface used to build the DOM tree</p> 42 <p>those are the default SAX2 interfaces used by the library when building DOM tree. </p> 43 <p>Author(s): Daniel Veillard </p> 44 <div class="refsynopsisdiv"> 45 <h2>Synopsis</h2> 46 <pre class="synopsis">void <a href="#xmlSAX2EndElementNs">xmlSAX2EndElementNs</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * localname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI); 47void <a href="#xmlSAX2Reference">xmlSAX2Reference</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name); 48void <a href="#xmlSAX2ElementDecl">xmlSAX2ElementDecl</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int type, <br/> <a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> content); 49void <a href="#xmlSAX2AttributeDecl">xmlSAX2AttributeDecl</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * elem, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * fullname, <br/> int type, <br/> int def, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * defaultValue, <br/> <a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> tree); 50void <a href="#xmlSAX2Comment">xmlSAX2Comment</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value); 51int <a href="#xmlSAX2GetColumnNumber">xmlSAX2GetColumnNumber</a> (void * ctx); 52<a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> <a href="#xmlSAX2GetEntity">xmlSAX2GetEntity</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name); 53void <a href="#xmlSAX2UnparsedEntityDecl">xmlSAX2UnparsedEntityDecl</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * notationName); 54void <a href="#xmlSAX2InitDocbDefaultSAXHandler">xmlSAX2InitDocbDefaultSAXHandler</a> (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr); 55int <a href="#xmlSAXVersion">xmlSAXVersion</a> (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr, <br/> int version); 56void <a href="#xmlSAX2IgnorableWhitespace">xmlSAX2IgnorableWhitespace</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ch, <br/> int len); 57void <a href="#xmlSAX2NotationDecl">xmlSAX2NotationDecl</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId); 58void <a href="#xmlSAX2StartDocument">xmlSAX2StartDocument</a> (void * ctx); 59void <a href="#xmlSAX2EndElement">xmlSAX2EndElement</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name); 60<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> <a href="#xmlSAX2ResolveEntity">xmlSAX2ResolveEntity</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId); 61void <a href="#xmlSAX2ExternalSubset">xmlSAX2ExternalSubset</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * SystemID); 62const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlSAX2GetPublicId">xmlSAX2GetPublicId</a> (void * ctx); 63int <a href="#xmlSAX2IsStandalone">xmlSAX2IsStandalone</a> (void * ctx); 64void <a href="#xmlSAX2EndDocument">xmlSAX2EndDocument</a> (void * ctx); 65void <a href="#xmlSAX2ProcessingInstruction">xmlSAX2ProcessingInstruction</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * target, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * data); 66void <a href="#xmlSAX2InternalSubset">xmlSAX2InternalSubset</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * SystemID); 67void <a href="#xmlSAX2Characters">xmlSAX2Characters</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ch, <br/> int len); 68int <a href="#xmlSAXDefaultVersion">xmlSAXDefaultVersion</a> (int version); 69void <a href="#xmlSAX2StartElement">xmlSAX2StartElement</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * fullname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** atts); 70void <a href="#xmlSAX2SetDocumentLocator">xmlSAX2SetDocumentLocator</a> (void * ctx, <br/> <a href="libxml2-tree.html#xmlSAXLocatorPtr">xmlSAXLocatorPtr</a> loc); 71void <a href="#xmlSAX2CDataBlock">xmlSAX2CDataBlock</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value, <br/> int len); 72void <a href="#xmlSAX2StartElementNs">xmlSAX2StartElementNs</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * localname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br/> int nb_namespaces, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** namespaces, <br/> int nb_attributes, <br/> int nb_defaulted, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** attributes); 73int <a href="#xmlSAX2HasExternalSubset">xmlSAX2HasExternalSubset</a> (void * ctx); 74void <a href="#htmlDefaultSAXHandlerInit">htmlDefaultSAXHandlerInit</a> (void); 75int <a href="#xmlSAX2GetLineNumber">xmlSAX2GetLineNumber</a> (void * ctx); 76int <a href="#xmlSAX2HasInternalSubset">xmlSAX2HasInternalSubset</a> (void * ctx); 77void <a href="#xmlSAX2InitHtmlDefaultSAXHandler">xmlSAX2InitHtmlDefaultSAXHandler</a> (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr); 78void <a href="#docbDefaultSAXHandlerInit">docbDefaultSAXHandlerInit</a> (void); 79void <a href="#xmlDefaultSAXHandlerInit">xmlDefaultSAXHandlerInit</a> (void); 80void <a href="#xmlSAX2InitDefaultSAXHandler">xmlSAX2InitDefaultSAXHandler</a> (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr, <br/> int warning); 81<a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> <a href="#xmlSAX2GetParameterEntity">xmlSAX2GetParameterEntity</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name); 82const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlSAX2GetSystemId">xmlSAX2GetSystemId</a> (void * ctx); 83void <a href="#xmlSAX2EntityDecl">xmlSAX2EntityDecl</a> (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int type, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId, <br/> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content); 84</pre> 85 </div> 86 <div class="refsect1" lang="en"> 87 <h2>Description</h2> 88 </div> 89 <div class="refsect1" lang="en"> 90 <h2>Details</h2> 91 <div class="refsect2" lang="en"> 92 <div class="refsect2" lang="en"><h3><a name="docbDefaultSAXHandlerInit"/>docbDefaultSAXHandlerInit ()</h3><pre class="programlisting">void docbDefaultSAXHandlerInit (void)<br/> 93</pre><p>Initialize the default SAX handler</p> 94</div> 95 <hr/> 96 <div class="refsect2" lang="en"><h3><a name="htmlDefaultSAXHandlerInit"/>htmlDefaultSAXHandlerInit ()</h3><pre class="programlisting">void htmlDefaultSAXHandlerInit (void)<br/> 97</pre><p>Initialize the default SAX handler</p> 98</div> 99 <hr/> 100 <div class="refsect2" lang="en"><h3><a name="xmlDefaultSAXHandlerInit"/>xmlDefaultSAXHandlerInit ()</h3><pre class="programlisting">void xmlDefaultSAXHandlerInit (void)<br/> 101</pre><p>Initialize the default SAX2 handler</p> 102</div> 103 <hr/> 104 <div class="refsect2" lang="en"><h3><a name="xmlSAX2AttributeDecl"/>xmlSAX2AttributeDecl ()</h3><pre class="programlisting">void xmlSAX2AttributeDecl (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * elem, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * fullname, <br/> int type, <br/> int def, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * defaultValue, <br/> <a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> tree)<br/> 105</pre><p>An <a href="libxml2-SAX.html#attribute">attribute</a> definition has been parsed</p> 106<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>the name of the element</td></tr><tr><td><span class="term"><i><tt>fullname</tt></i>:</span></td><td>the <a href="libxml2-SAX.html#attribute">attribute</a> name</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>the <a href="libxml2-SAX.html#attribute">attribute</a> type</td></tr><tr><td><span class="term"><i><tt>def</tt></i>:</span></td><td>the type of default value</td></tr><tr><td><span class="term"><i><tt>defaultValue</tt></i>:</span></td><td>the <a href="libxml2-SAX.html#attribute">attribute</a> default value</td></tr><tr><td><span class="term"><i><tt>tree</tt></i>:</span></td><td>the tree of enumerated value set</td></tr></tbody></table></div></div> 107 <hr/> 108 <div class="refsect2" lang="en"><h3><a name="xmlSAX2CDataBlock"/>xmlSAX2CDataBlock ()</h3><pre class="programlisting">void xmlSAX2CDataBlock (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value, <br/> int len)<br/> 109</pre><p>called when a pcdata block has been parsed</p> 110<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>The pcdata content</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the block length</td></tr></tbody></table></div></div> 111 <hr/> 112 <div class="refsect2" lang="en"><h3><a name="xmlSAX2Characters"/>xmlSAX2Characters ()</h3><pre class="programlisting">void xmlSAX2Characters (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ch, <br/> int len)<br/> 113</pre><p>receiving some chars from the parser.</p> 114<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>ch</tt></i>:</span></td><td>a <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> string</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the number of <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a></td></tr></tbody></table></div></div> 115 <hr/> 116 <div class="refsect2" lang="en"><h3><a name="xmlSAX2Comment"/>xmlSAX2Comment ()</h3><pre class="programlisting">void xmlSAX2Comment (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value)<br/> 117</pre><p>A <a href="libxml2-SAX2.html#xmlSAX2Comment">xmlSAX2Comment</a> has been parsed.</p> 118<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>the <a href="libxml2-SAX2.html#xmlSAX2Comment">xmlSAX2Comment</a> content</td></tr></tbody></table></div></div> 119 <hr/> 120 <div class="refsect2" lang="en"><h3><a name="xmlSAX2ElementDecl"/>xmlSAX2ElementDecl ()</h3><pre class="programlisting">void xmlSAX2ElementDecl (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int type, <br/> <a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> content)<br/> 121</pre><p>An element definition has been parsed</p> 122<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the element name</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>the element type</td></tr><tr><td><span class="term"><i><tt>content</tt></i>:</span></td><td>the element value tree</td></tr></tbody></table></div></div> 123 <hr/> 124 <div class="refsect2" lang="en"><h3><a name="xmlSAX2EndDocument"/>xmlSAX2EndDocument ()</h3><pre class="programlisting">void xmlSAX2EndDocument (void * ctx)<br/> 125</pre><p>called when the document end has been detected.</p> 126<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr></tbody></table></div></div> 127 <hr/> 128 <div class="refsect2" lang="en"><h3><a name="xmlSAX2EndElement"/>xmlSAX2EndElement ()</h3><pre class="programlisting">void xmlSAX2EndElement (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br/> 129</pre><p>called when the end of an element has been detected.</p> 130<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>The element name</td></tr></tbody></table></div></div> 131 <hr/> 132 <div class="refsect2" lang="en"><h3><a name="xmlSAX2EndElementNs"/>xmlSAX2EndElementNs ()</h3><pre class="programlisting">void xmlSAX2EndElementNs (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * localname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI)<br/> 133</pre><p>SAX2 callback when an element end has been detected by the parser. It provides the namespace informations for the element.</p> 134<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>localname</tt></i>:</span></td><td>the local name of the element</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>the element namespace prefix if available</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>the element namespace name if available</td></tr></tbody></table></div></div> 135 <hr/> 136 <div class="refsect2" lang="en"><h3><a name="xmlSAX2EntityDecl"/>xmlSAX2EntityDecl ()</h3><pre class="programlisting">void xmlSAX2EntityDecl (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int type, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId, <br/> <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br/> 137</pre><p>An entity definition has been parsed</p> 138<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><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>type</tt></i>:</span></td><td>the entity type</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td>The public ID of the entity</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td>The system ID of the entity</td></tr><tr><td><span class="term"><i><tt>content</tt></i>:</span></td><td>the entity value (without processing).</td></tr></tbody></table></div></div> 139 <hr/> 140 <div class="refsect2" lang="en"><h3><a name="xmlSAX2ExternalSubset"/>xmlSAX2ExternalSubset ()</h3><pre class="programlisting">void xmlSAX2ExternalSubset (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * SystemID)<br/> 141</pre><p>Callback on external subset declaration.</p> 142<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the root element name</td></tr><tr><td><span class="term"><i><tt>ExternalID</tt></i>:</span></td><td>the external ID</td></tr><tr><td><span class="term"><i><tt>SystemID</tt></i>:</span></td><td>the SYSTEM ID (e.g. filename or URL)</td></tr></tbody></table></div></div> 143 <hr/> 144 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetColumnNumber"/>xmlSAX2GetColumnNumber ()</h3><pre class="programlisting">int xmlSAX2GetColumnNumber (void * ctx)<br/> 145</pre><p>Provide the column number of the current parsing point.</p> 146<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an int</td></tr></tbody></table></div></div> 147 <hr/> 148 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetEntity"/>xmlSAX2GetEntity ()</h3><pre class="programlisting"><a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> xmlSAX2GetEntity (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br/> 149</pre><p>Get an entity by name</p> 150<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><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 <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> if found.</td></tr></tbody></table></div></div> 151 <hr/> 152 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetLineNumber"/>xmlSAX2GetLineNumber ()</h3><pre class="programlisting">int xmlSAX2GetLineNumber (void * ctx)<br/> 153</pre><p>Provide the line number of the current parsing point.</p> 154<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an int</td></tr></tbody></table></div></div> 155 <hr/> 156 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetParameterEntity"/>xmlSAX2GetParameterEntity ()</h3><pre class="programlisting"><a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> xmlSAX2GetParameterEntity (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br/> 157</pre><p>Get a parameter entity by name</p> 158<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><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 <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> if found.</td></tr></tbody></table></div></div> 159 <hr/> 160 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetPublicId"/>xmlSAX2GetPublicId ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlSAX2GetPublicId (void * ctx)<br/> 161</pre><p>Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"</p> 162<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *</td></tr></tbody></table></div></div> 163 <hr/> 164 <div class="refsect2" lang="en"><h3><a name="xmlSAX2GetSystemId"/>xmlSAX2GetSystemId ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlSAX2GetSystemId (void * ctx)<br/> 165</pre><p>Provides the system ID, basically URL or filename e.g. http://www.sgmlsource.com/dtds/memo.dtd</p> 166<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *</td></tr></tbody></table></div></div> 167 <hr/> 168 <div class="refsect2" lang="en"><h3><a name="xmlSAX2HasExternalSubset"/>xmlSAX2HasExternalSubset ()</h3><pre class="programlisting">int xmlSAX2HasExternalSubset (void * ctx)<br/> 169</pre><p>Does this document has an external subset</p> 170<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if true</td></tr></tbody></table></div></div> 171 <hr/> 172 <div class="refsect2" lang="en"><h3><a name="xmlSAX2HasInternalSubset"/>xmlSAX2HasInternalSubset ()</h3><pre class="programlisting">int xmlSAX2HasInternalSubset (void * ctx)<br/> 173</pre><p>Does this document has an internal subset</p> 174<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if true</td></tr></tbody></table></div></div> 175 <hr/> 176 <div class="refsect2" lang="en"><h3><a name="xmlSAX2IgnorableWhitespace"/>xmlSAX2IgnorableWhitespace ()</h3><pre class="programlisting">void xmlSAX2IgnorableWhitespace (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ch, <br/> int len)<br/> 177</pre><p>receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use <a href="libxml2-SAX2.html#xmlSAX2Characters">xmlSAX2Characters</a></p> 178<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>ch</tt></i>:</span></td><td>a <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> string</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the number of <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a></td></tr></tbody></table></div></div> 179 <hr/> 180 <div class="refsect2" lang="en"><h3><a name="xmlSAX2InitDefaultSAXHandler"/>xmlSAX2InitDefaultSAXHandler ()</h3><pre class="programlisting">void xmlSAX2InitDefaultSAXHandler (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr, <br/> int warning)<br/> 181</pre><p>Initialize the default XML SAX2 handler</p> 182<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>hdlr</tt></i>:</span></td><td>the SAX handler</td></tr><tr><td><span class="term"><i><tt>warning</tt></i>:</span></td><td>flag if non-zero sets the handler warning procedure</td></tr></tbody></table></div></div> 183 <hr/> 184 <div class="refsect2" lang="en"><h3><a name="xmlSAX2InitDocbDefaultSAXHandler"/>xmlSAX2InitDocbDefaultSAXHandler ()</h3><pre class="programlisting">void xmlSAX2InitDocbDefaultSAXHandler (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr)<br/> 185</pre><p>Initialize the default DocBook SAX2 handler</p> 186<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>hdlr</tt></i>:</span></td><td>the SAX handler</td></tr></tbody></table></div></div> 187 <hr/> 188 <div class="refsect2" lang="en"><h3><a name="xmlSAX2InitHtmlDefaultSAXHandler"/>xmlSAX2InitHtmlDefaultSAXHandler ()</h3><pre class="programlisting">void xmlSAX2InitHtmlDefaultSAXHandler (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr)<br/> 189</pre><p>Initialize the default HTML SAX2 handler</p> 190<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>hdlr</tt></i>:</span></td><td>the SAX handler</td></tr></tbody></table></div></div> 191 <hr/> 192 <div class="refsect2" lang="en"><h3><a name="xmlSAX2InternalSubset"/>xmlSAX2InternalSubset ()</h3><pre class="programlisting">void xmlSAX2InternalSubset (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * SystemID)<br/> 193</pre><p>Callback on internal subset declaration.</p> 194<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the root element name</td></tr><tr><td><span class="term"><i><tt>ExternalID</tt></i>:</span></td><td>the external ID</td></tr><tr><td><span class="term"><i><tt>SystemID</tt></i>:</span></td><td>the SYSTEM ID (e.g. filename or URL)</td></tr></tbody></table></div></div> 195 <hr/> 196 <div class="refsect2" lang="en"><h3><a name="xmlSAX2IsStandalone"/>xmlSAX2IsStandalone ()</h3><pre class="programlisting">int xmlSAX2IsStandalone (void * ctx)<br/> 197</pre><p>Is this document tagged standalone ?</p> 198<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if true</td></tr></tbody></table></div></div> 199 <hr/> 200 <div class="refsect2" lang="en"><h3><a name="xmlSAX2NotationDecl"/>xmlSAX2NotationDecl ()</h3><pre class="programlisting">void xmlSAX2NotationDecl (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId)<br/> 201</pre><p>What to do when a notation declaration has been parsed.</p> 202<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>The name of the notation</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td>The public ID of the entity</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td>The system ID of the entity</td></tr></tbody></table></div></div> 203 <hr/> 204 <div class="refsect2" lang="en"><h3><a name="xmlSAX2ProcessingInstruction"/>xmlSAX2ProcessingInstruction ()</h3><pre class="programlisting">void xmlSAX2ProcessingInstruction (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * target, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * data)<br/> 205</pre><p>A processing instruction has been parsed.</p> 206<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>the target name</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>the PI data's</td></tr></tbody></table></div></div> 207 <hr/> 208 <div class="refsect2" lang="en"><h3><a name="xmlSAX2Reference"/>xmlSAX2Reference ()</h3><pre class="programlisting">void xmlSAX2Reference (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br/> 209</pre><p>called when an entity <a href="libxml2-SAX2.html#xmlSAX2Reference">xmlSAX2Reference</a> is detected.</p> 210<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>The entity name</td></tr></tbody></table></div></div> 211 <hr/> 212 <div class="refsect2" lang="en"><h3><a name="xmlSAX2ResolveEntity"/>xmlSAX2ResolveEntity ()</h3><pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> xmlSAX2ResolveEntity (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId)<br/> 213</pre><p>The entity loader, to control the loading of external entities, the application can either: - override this xmlSAX2ResolveEntity() callback in the SAX block - or better use the xmlSetExternalEntityLoader() function to set up it's own entity resolution routine</p> 214<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td>The public ID of the entity</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td>The system ID of the entity</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> if inlined or NULL for DOM behaviour.</td></tr></tbody></table></div></div> 215 <hr/> 216 <div class="refsect2" lang="en"><h3><a name="xmlSAX2SetDocumentLocator"/>xmlSAX2SetDocumentLocator ()</h3><pre class="programlisting">void xmlSAX2SetDocumentLocator (void * ctx, <br/> <a href="libxml2-tree.html#xmlSAXLocatorPtr">xmlSAXLocatorPtr</a> loc)<br/> 217</pre><p>Receive the document locator at startup, actually <a href="libxml2-globals.html#xmlDefaultSAXLocator">xmlDefaultSAXLocator</a> Everything is available on the context, so this is useless in our case.</p> 218<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>loc</tt></i>:</span></td><td>A SAX Locator</td></tr></tbody></table></div></div> 219 <hr/> 220 <div class="refsect2" lang="en"><h3><a name="xmlSAX2StartDocument"/>xmlSAX2StartDocument ()</h3><pre class="programlisting">void xmlSAX2StartDocument (void * ctx)<br/> 221</pre><p>called when the document start being processed.</p> 222<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr></tbody></table></div></div> 223 <hr/> 224 <div class="refsect2" lang="en"><h3><a name="xmlSAX2StartElement"/>xmlSAX2StartElement ()</h3><pre class="programlisting">void xmlSAX2StartElement (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * fullname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** atts)<br/> 225</pre><p>called when an opening tag has been processed.</p> 226<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>fullname</tt></i>:</span></td><td>The element name, including namespace prefix</td></tr><tr><td><span class="term"><i><tt>atts</tt></i>:</span></td><td>An array of name/value attributes pairs, NULL terminated</td></tr></tbody></table></div></div> 227 <hr/> 228 <div class="refsect2" lang="en"><h3><a name="xmlSAX2StartElementNs"/>xmlSAX2StartElementNs ()</h3><pre class="programlisting">void xmlSAX2StartElementNs (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * localname, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * URI, <br/> int nb_namespaces, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** namespaces, <br/> int nb_attributes, <br/> int nb_defaulted, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** attributes)<br/> 229</pre><p>SAX2 callback when an element start has been detected by the parser. It provides the namespace informations for the element, as well as the new namespace declarations on the element.</p> 230<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>localname</tt></i>:</span></td><td>the local name of the element</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>the element namespace prefix if available</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>the element namespace name if available</td></tr><tr><td><span class="term"><i><tt>nb_namespaces</tt></i>:</span></td><td>number of namespace definitions on that node</td></tr><tr><td><span class="term"><i><tt>namespaces</tt></i>:</span></td><td>pointer to the array of prefix/URI pairs namespace definitions</td></tr><tr><td><span class="term"><i><tt>nb_attributes</tt></i>:</span></td><td>the number of attributes on that node</td></tr><tr><td><span class="term"><i><tt>nb_defaulted</tt></i>:</span></td><td>the number of defaulted attributes.</td></tr><tr><td><span class="term"><i><tt>attributes</tt></i>:</span></td><td>pointer to the array of (localname/prefix/URI/value/end) <a href="libxml2-SAX.html#attribute">attribute</a> values.</td></tr></tbody></table></div></div> 231 <hr/> 232 <div class="refsect2" lang="en"><h3><a name="xmlSAX2UnparsedEntityDecl"/>xmlSAX2UnparsedEntityDecl ()</h3><pre class="programlisting">void xmlSAX2UnparsedEntityDecl (void * ctx, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * publicId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * systemId, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * notationName)<br/> 233</pre><p>What to do when an unparsed entity declaration is parsed</p> 234<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the user data (XML parser context)</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>The name of the entity</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td>The public ID of the entity</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td>The system ID of the entity</td></tr><tr><td><span class="term"><i><tt>notationName</tt></i>:</span></td><td>the name of the notation</td></tr></tbody></table></div></div> 235 <hr/> 236 <div class="refsect2" lang="en"><h3><a name="xmlSAXDefaultVersion"/>xmlSAXDefaultVersion ()</h3><pre class="programlisting">int xmlSAXDefaultVersion (int version)<br/> 237</pre><p>Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.</p> 238<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>version</tt></i>:</span></td><td>the version, 1 or 2</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the previous value in case of success and -1 in case of error.</td></tr></tbody></table></div></div> 239 <hr/> 240 <div class="refsect2" lang="en"><h3><a name="xmlSAXVersion"/>xmlSAXVersion ()</h3><pre class="programlisting">int xmlSAXVersion (<a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * hdlr, <br/> int version)<br/> 241</pre><p>Initialize the default XML SAX handler according to the version</p> 242<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>hdlr</tt></i>:</span></td><td>the SAX handler</td></tr><tr><td><span class="term"><i><tt>version</tt></i>:</span></td><td>the version, 1 or 2</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of error.</td></tr></tbody></table></div></div> 243 <hr/> 244 </div> 245 </div> 246 </body> 247</html> 248