libxml-parser.html revision 2ad1dfffa032025ec70de5b4af878e9b092c79f3
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>parser</title><meta name="generator" content="DocBook XSL Stylesheets V1.48"><meta name="generator" content="GTK-Doc V1.1 (XML mode)"><style type="text/css">
2        .synopsis, .classsynopsis {
3            background: #eeeeee;
4            border: solid 1px #aaaaaa;
5            padding: 0.5em;
6        }
7        .programlisting {
8            background: #eeeeff;
9            border: solid 1px #aaaaff;
10            padding: 0.5em;
11        }
12        .variablelist {
13            padding: 4px;
14            margin-left: 3em;
15        }
16        .navigation {
17            background: #ffeeee;
18            border: solid 1px #ffaaaa;
19            margin-top: 0.5em;
20            margin-bottom: 0.5em;
21        }
22        .navigation a {
23            color: #770000;
24        }
25        .navigation a:visited {
26            color: #550000;
27        }
28        .navigation .title {
29            font-size: 200%;
30        }
31      </style><link rel="home" href="index.html" title="Gnome XML Library Reference Manual "><link rel="up" href="ch01.html" title="Libxml Programming Notes"><link rel="previous" href="libxml-threads.html" title="threads"><link rel="next" href="libxml-c14n.html" title="c14n"></head><body 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="p" href="libxml-threads.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="ch01.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><th width="100%" align="center">Gnome XML Library Reference Manual </th><td><a accesskey="n" href="libxml-c14n.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry"><a name="libxml-parser"></a><div class="titlepage"></div><div class="refnamediv"><h2>parser</h2><p>parser &#8212; </p></div><div class="refsynopsisdiv"><h2><h1 class="title"><a name="id2595846"></a>Synopsis</h1></h2><pre class="synopsis">
32
33
34
35#define     <a href="libxml-parser.html#XML-DEFAULT-VERSION-CAPS">XML_DEFAULT_VERSION</a>
36void        (<a href="libxml-parser.html#xmlParserInputDeallocate">*xmlParserInputDeallocate</a>)     (<a href="libxml-tree.html#xmlChar">xmlChar</a> *str);
37struct      <a href="libxml-parser.html#xmlParserInput">xmlParserInput</a>;
38struct      <a href="libxml-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a>;
39typedef     <a href="libxml-parser.html#xmlParserNodeInfoPtr">xmlParserNodeInfoPtr</a>;
40struct      <a href="libxml-parser.html#xmlParserNodeInfoSeq">xmlParserNodeInfoSeq</a>;
41typedef     <a href="libxml-parser.html#xmlParserNodeInfoSeqPtr">xmlParserNodeInfoSeqPtr</a>;
42enum        <a href="libxml-parser.html#xmlParserInputState">xmlParserInputState</a>;
43#define     <a href="libxml-parser.html#XML-DETECT-IDS-CAPS">XML_DETECT_IDS</a>
44#define     <a href="libxml-parser.html#XML-COMPLETE-ATTRS-CAPS">XML_COMPLETE_ATTRS</a>
45#define     <a href="libxml-parser.html#XML-SKIP-IDS-CAPS">XML_SKIP_IDS</a>
46struct      <a href="libxml-parser.html#xmlParserCtxt">xmlParserCtxt</a>;
47struct      <a href="libxml-parser.html#xmlSAXLocator">xmlSAXLocator</a>;
48<a href="libxml-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> (<a href="libxml-parser.html#resolveEntitySAXFunc">*resolveEntitySAXFunc</a>)   (void *ctx,
49                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
50                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId);
51void        (<a href="libxml-parser.html#internalSubsetSAXFunc">*internalSubsetSAXFunc</a>)        (void *ctx,
52                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
53                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ExternalID,
54                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *SystemID);
55void        (<a href="libxml-parser.html#externalSubsetSAXFunc">*externalSubsetSAXFunc</a>)        (void *ctx,
56                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
57                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ExternalID,
58                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *SystemID);
59<a href="libxml-tree.html#xmlEntityPtr">xmlEntityPtr</a> (<a href="libxml-parser.html#getEntitySAXFunc">*getEntitySAXFunc</a>)            (void *ctx,
60                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);
61<a href="libxml-tree.html#xmlEntityPtr">xmlEntityPtr</a> (<a href="libxml-parser.html#getParameterEntitySAXFunc">*getParameterEntitySAXFunc</a>)   (void *ctx,
62                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);
63void        (<a href="libxml-parser.html#entityDeclSAXFunc">*entityDeclSAXFunc</a>)            (void *ctx,
64                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
65                                             int type,
66                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
67                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId,
68                                             <a href="libxml-tree.html#xmlChar">xmlChar</a> *content);
69void        (<a href="libxml-parser.html#notationDeclSAXFunc">*notationDeclSAXFunc</a>)          (void *ctx,
70                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
71                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
72                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId);
73void        (<a href="libxml-parser.html#attributeDeclSAXFunc">*attributeDeclSAXFunc</a>)         (void *ctx,
74                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *elem,
75                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *fullname,
76                                             int type,
77                                             int def,
78                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *defaultValue,
79                                             <a href="libxml-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> tree);
80void        (<a href="libxml-parser.html#elementDeclSAXFunc">*elementDeclSAXFunc</a>)           (void *ctx,
81                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
82                                             int type,
83                                             <a href="libxml-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> content);
84void        (<a href="libxml-parser.html#unparsedEntityDeclSAXFunc">*unparsedEntityDeclSAXFunc</a>)    (void *ctx,
85                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
86                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
87                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId,
88                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *notationName);
89void        (<a href="libxml-parser.html#setDocumentLocatorSAXFunc">*setDocumentLocatorSAXFunc</a>)    (void *ctx,
90                                             <a href="libxml-tree.html#xmlSAXLocatorPtr">xmlSAXLocatorPtr</a> loc);
91void        (<a href="libxml-parser.html#startDocumentSAXFunc">*startDocumentSAXFunc</a>)         (void *ctx);
92void        (<a href="libxml-parser.html#endDocumentSAXFunc">*endDocumentSAXFunc</a>)           (void *ctx);
93void        (<a href="libxml-parser.html#startElementSAXFunc">*startElementSAXFunc</a>)          (void *ctx,
94                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
95                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **atts);
96void        (<a href="libxml-parser.html#endElementSAXFunc">*endElementSAXFunc</a>)            (void *ctx,
97                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);
98void        (<a href="libxml-parser.html#attributeSAXFunc">*attributeSAXFunc</a>)             (void *ctx,
99                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
100                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);
101void        (<a href="libxml-parser.html#referenceSAXFunc">*referenceSAXFunc</a>)             (void *ctx,
102                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);
103void        (<a href="libxml-parser.html#charactersSAXFunc">*charactersSAXFunc</a>)            (void *ctx,
104                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ch,
105                                             int len);
106void        (<a href="libxml-parser.html#ignorableWhitespaceSAXFunc">*ignorableWhitespaceSAXFunc</a>)   (void *ctx,
107                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ch,
108                                             int len);
109void        (<a href="libxml-parser.html#processingInstructionSAXFunc">*processingInstructionSAXFunc</a>) (void *ctx,
110                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *target,
111                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *data);
112void        (<a href="libxml-parser.html#commentSAXFunc">*commentSAXFunc</a>)               (void *ctx,
113                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);
114void        (<a href="libxml-parser.html#cdataBlockSAXFunc">*cdataBlockSAXFunc</a>)            (void *ctx,
115                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
116                                             int len);
117void        (<a href="libxml-parser.html#warningSAXFunc">*warningSAXFunc</a>)               (void *ctx,
118                                             const char *msg,
119                                             ...);
120void        (<a href="libxml-parser.html#errorSAXFunc">*errorSAXFunc</a>)                 (void *ctx,
121                                             const char *msg,
122                                             ...);
123void        (<a href="libxml-parser.html#fatalErrorSAXFunc">*fatalErrorSAXFunc</a>)            (void *ctx,
124                                             const char *msg,
125                                             ...);
126int         (<a href="libxml-parser.html#isStandaloneSAXFunc">*isStandaloneSAXFunc</a>)          (void *ctx);
127int         (<a href="libxml-parser.html#hasInternalSubsetSAXFunc">*hasInternalSubsetSAXFunc</a>)     (void *ctx);
128int         (<a href="libxml-parser.html#hasExternalSubsetSAXFunc">*hasExternalSubsetSAXFunc</a>)     (void *ctx);
129#define     <a href="libxml-parser.html#XML-SAX2-MAGIC-CAPS">XML_SAX2_MAGIC</a>
130void        (<a href="libxml-parser.html#startElementNsSAX2Func">*startElementNsSAX2Func</a>)       (void *ctx,
131                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *localname,
132                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *prefix,
133                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI,
134                                             int nb_namespaces,
135                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **namespaces,
136                                             int nb_attributes,
137                                             int nb_defaulted,
138                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **attributes);
139void        (<a href="libxml-parser.html#endElementNsSAX2Func">*endElementNsSAX2Func</a>)         (void *ctx,
140                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *localname,
141                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *prefix,
142                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI);
143struct      <a href="libxml-parser.html#xmlSAXHandler">xmlSAXHandler</a>;
144struct      <a href="libxml-parser.html#xmlSAXHandlerV1">xmlSAXHandlerV1</a>;
145typedef     <a href="libxml-parser.html#xmlSAXHandlerV1Ptr">xmlSAXHandlerV1Ptr</a>;
146<a href="libxml-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> (<a href="libxml-parser.html#xmlExternalEntityLoader">*xmlExternalEntityLoader</a>)
147                                            (const char *URL,
148                                             const char *ID,
149                                             <a href="libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> context);
150enum        <a href="libxml-parser.html#xmlParserOption">xmlParserOption</a>;
151</pre></div><div class="refsect1"><h2>Description</h2><p>
152
153</p></div><div class="refsect1"><h2>Details</h2><div class="refsect2"><h3><a name="XML-DEFAULT-VERSION-CAPS"></a>XML_DEFAULT_VERSION</h3><pre class="programlisting">#define XML_DEFAULT_VERSION	"1.0"
154</pre><p>
155The default version of XML used: 1.0</p><p>
156
157</p></div><hr><div class="refsect2"><h3><a name="xmlParserInputDeallocate"></a>xmlParserInputDeallocate ()</h3><pre class="programlisting">void        (*xmlParserInputDeallocate)     (<a href="libxml-tree.html#xmlChar">xmlChar</a> *str);</pre><p>
158Callback for freeing some parser input allocations.</p><p>
159
160</p><div class="variablelist"><table border="0"><col align="left"><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>  the string to deallocate
161</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="xmlParserInput"></a>struct xmlParserInput</h3><pre class="programlisting">struct xmlParserInput {
162
163    /* Input buffer */
164    xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
165
166    const char *filename;             /* The file analyzed, if any */
167    const char *directory;            /* the directory/base of the file */
168    const xmlChar *base;              /* Base of the array to parse */
169    const xmlChar *cur;               /* Current char being parsed */
170    const xmlChar *end;               /* end of the array to parse */
171    int length;                       /* length if known */
172    int line;                         /* Current line */
173    int col;                          /* Current column */
174    /*
175     * NOTE: consumed is only tested for equality in the parser code,
176     *       so even if there is an overflow this should not give troubles
177     *       for parsing very large instances.
178     */
179    unsigned long consumed;           /* How many xmlChars already consumed */
180    xmlParserInputDeallocate free;    /* function to deallocate the base */
181    const xmlChar *encoding;          /* the encoding string for entity */
182    const xmlChar *version;           /* the version string for entity */
183    int standalone;                   /* Was that entity marked standalone */
184    int id;                           /* an unique identifier for the entity */
185};
186</pre><p>
187An xmlParserInput is an input flow for the XML processor.
188Each entity parsed is associated an xmlParserInput (except the
189few predefined ones). This is the case both for internal entities
190- in which case the flow is already completely in memory - or
191external entities - in which case we use the buf structure for
192progressive reading and I18N conversions to the internal UTF-8 format.</p><p>
193
194</p></div><hr><div class="refsect2"><h3><a name="xmlParserNodeInfo"></a>struct xmlParserNodeInfo</h3><pre class="programlisting">struct xmlParserNodeInfo {
195
196  const struct _xmlNode* node;
197  /* Position &amp; line # that text that created the node begins &amp; ends on */
198  unsigned long begin_pos;
199  unsigned long begin_line;
200  unsigned long end_pos;
201  unsigned long end_line;
202};
203</pre><p>
204The parser can be asked to collect Node informations, i.e. at what
205place in the file they were detected. 
206NOTE: This is off by default and not very well tested.</p><p>
207
208</p></div><hr><div class="refsect2"><h3><a name="xmlParserNodeInfoPtr"></a>xmlParserNodeInfoPtr</h3><pre class="programlisting">typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
209</pre><p>
210
211</p></div><hr><div class="refsect2"><h3><a name="xmlParserNodeInfoSeq"></a>struct xmlParserNodeInfoSeq</h3><pre class="programlisting">struct xmlParserNodeInfoSeq {
212
213  unsigned long maximum;
214  unsigned long length;
215  xmlParserNodeInfo* buffer;
216};
217</pre><p>
218
219</p></div><hr><div class="refsect2"><h3><a name="xmlParserNodeInfoSeqPtr"></a>xmlParserNodeInfoSeqPtr</h3><pre class="programlisting">typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
220</pre><p>
221
222</p></div><hr><div class="refsect2"><h3><a name="xmlParserInputState"></a>enum xmlParserInputState</h3><pre class="programlisting">typedef enum {
223    XML_PARSER_EOF = -1,	/* nothing is to be parsed */
224    XML_PARSER_START = 0,	/* nothing has been parsed */
225    XML_PARSER_MISC,		/* Misc* before int subset */
226    XML_PARSER_PI,		/* Within a processing instruction */
227    XML_PARSER_DTD,		/* within some DTD content */
228    XML_PARSER_PROLOG,		/* Misc* after internal subset */
229    XML_PARSER_COMMENT,		/* within a comment */
230    XML_PARSER_START_TAG,	/* within a start tag */
231    XML_PARSER_CONTENT,		/* within the content */
232    XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
233    XML_PARSER_END_TAG,		/* within a closing tag */
234    XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
235    XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
236    XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
237    XML_PARSER_SYSTEM_LITERAL,	/* within a SYSTEM value */
238    XML_PARSER_EPILOG, 		/* the Misc* after the last end tag */
239    XML_PARSER_IGNORE,		/* within an IGNORED section */
240    XML_PARSER_PUBLIC_LITERAL 	/* within a PUBLIC value */
241} xmlParserInputState;
242</pre><p>
243The parser is now working also as a state based parser.
244The recursive one use the state info for entities processing.</p><p>
245
246</p></div><hr><div class="refsect2"><h3><a name="XML-DETECT-IDS-CAPS"></a>XML_DETECT_IDS</h3><pre class="programlisting">#define XML_DETECT_IDS		2
247</pre><p>
248Bit in the loadsubset context field to tell to do ID/REFs lookups.
249Use it to initialize xmlLoadExtDtdDefaultValue.</p><p>
250
251</p></div><hr><div class="refsect2"><h3><a name="XML-COMPLETE-ATTRS-CAPS"></a>XML_COMPLETE_ATTRS</h3><pre class="programlisting">#define XML_COMPLETE_ATTRS	4
252</pre><p>
253Bit in the loadsubset context field to tell to do complete the
254elements attributes lists with the ones defaulted from the DTDs.
255Use it to initialize xmlLoadExtDtdDefaultValue.</p><p>
256
257</p></div><hr><div class="refsect2"><h3><a name="XML-SKIP-IDS-CAPS"></a>XML_SKIP_IDS</h3><pre class="programlisting">#define XML_SKIP_IDS		8
258</pre><p>
259Bit in the loadsubset context field to tell to not do ID/REFs registration.
260Used to initialize xmlLoadExtDtdDefaultValue in some special cases.</p><p>
261
262</p></div><hr><div class="refsect2"><h3><a name="xmlParserCtxt"></a>struct xmlParserCtxt</h3><pre class="programlisting">struct xmlParserCtxt {
263
264    struct _xmlSAXHandler *sax;       /* The SAX handler */
265    void            *userData;        /* For SAX interface only, used by DOM build */
266    xmlDocPtr           myDoc;        /* the document being built */
267    int            wellFormed;        /* is the document well formed */
268    int       replaceEntities;        /* shall we replace entities ? */
269    const xmlChar    *version;        /* the XML version string */
270    const xmlChar   *encoding;        /* the declared encoding, if any */
271    int            standalone;        /* standalone document */
272    int                  html;        /* an HTML(1)/Docbook(2) document */
273
274    /* Input stream stack */
275    xmlParserInputPtr  input;         /* Current input stream */
276    int                inputNr;       /* Number of current input streams */
277    int                inputMax;      /* Max number of input streams */
278    xmlParserInputPtr *inputTab;      /* stack of inputs */
279
280    /* Node analysis stack only used for DOM building */
281    xmlNodePtr         node;          /* Current parsed Node */
282    int                nodeNr;        /* Depth of the parsing stack */
283    int                nodeMax;       /* Max depth of the parsing stack */
284    xmlNodePtr        *nodeTab;       /* array of nodes */
285
286    int record_info;                  /* Whether node info should be kept */
287    xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
288
289    int errNo;                        /* error code */
290
291    int     hasExternalSubset;        /* reference and external subset */
292    int             hasPErefs;        /* the internal subset has PE refs */
293    int              external;        /* are we parsing an external entity */
294
295    int                 valid;        /* is the document valid */
296    int              validate;        /* shall we try to validate ? */
297    xmlValidCtxt        vctxt;        /* The validity context */
298
299    xmlParserInputState instate;      /* current type of input */
300    int                 token;        /* next char look-ahead */    
301
302    char           *directory;        /* the data directory */
303
304    /* Node name stack */
305    const xmlChar     *name;          /* Current parsed Node */
306    int                nameNr;        /* Depth of the parsing stack */
307    int                nameMax;       /* Max depth of the parsing stack */
308    const xmlChar *   *nameTab;       /* array of nodes */
309
310    long               nbChars;       /* number of xmlChar processed */
311    long            checkIndex;       /* used by progressive parsing lookup */
312    int             keepBlanks;       /* ugly but ... */
313    int             disableSAX;       /* SAX callbacks are disabled */
314    int               inSubset;       /* Parsing is in int 1/ext 2 subset */
315    const xmlChar *    intSubName;    /* name of subset */
316    xmlChar *          extSubURI;     /* URI of external subset */
317    xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
318
319    /* xml:space values */
320    int *              space;         /* Should the parser preserve spaces */
321    int                spaceNr;       /* Depth of the parsing stack */
322    int                spaceMax;      /* Max depth of the parsing stack */
323    int *              spaceTab;      /* array of space infos */
324
325    int                depth;         /* to prevent entity substitution loops */
326    xmlParserInputPtr  entity;        /* used to check entities boundaries */
327    int                charset;       /* encoding of the in-memory content
328				         actually an xmlCharEncoding */
329    int                nodelen;       /* Those two fields are there to */
330    int                nodemem;       /* Speed up large node parsing */
331    int                pedantic;      /* signal pedantic warnings */
332    void              *_private;      /* For user data, libxml won't touch it */
333
334    int                loadsubset;    /* should the external subset be loaded */
335    int                linenumbers;   /* set line number in element content */
336    void              *catalogs;       /* document's own catalog */
337    int                recovery;      /* run in recovery mode */
338    int                progressive;   /* is this a progressive parsing */
339    xmlDictPtr         dict;          /* dictionnary for the parser */
340    const xmlChar *   *atts;          /* array for the attributes callbacks */
341    int                maxatts;       /* the size of the array */
342    int                docdict;       /* use strings from dict to build tree */
343
344    /*
345     * pre-interned strings
346     */
347    const xmlChar *str_xml;
348    const xmlChar *str_xmlns;
349    const xmlChar *str_xml_ns;
350
351    /*
352     * Everything below is used only by the new SAX mode
353     */
354    int                sax2;          /* operating in the new SAX mode */
355    int                nsNr;          /* the number of inherited namespaces */
356    int                nsMax;         /* the size of the arrays */
357    const xmlChar *   *nsTab;         /* the array of prefix/namespace name */
358    int               *attallocs;     /* which attribute were allocated */
359    void *            *pushTab;       /* array of data for push */
360    xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */
361    xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */
362    int                nsWellFormed;  /* is the document XML Nanespace okay */
363    int                options;       /* Extra options */
364
365    /*
366     * Those fields are needed only for treaming parsing so far
367     */
368    int               dictNames;    /* Use dictionary names for the tree */
369    int               freeElemsNr;  /* number of freed element nodes */
370    xmlNodePtr        freeElems;    /* List of freed element nodes */
371    int               freeAttrsNr;  /* number of freed attributes nodes */
372    xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */
373
374    /*
375     * the complete error informations for the last error.
376     */
377    xmlError          lastError;
378};
379</pre><p>
380The parser context.
381NOTE This doesn't completely define the parser state, the (current ?)
382     design of the parser uses recursive function calls since this allow
383     and easy mapping from the production rules of the specification
384     to the actual code. The drawback is that the actual function call
385     also reflect the parser state. However most of the parsing routines
386     takes as the only argument the parser context pointer, so migrating
387     to a state based parser for progressive parsing shouldn't be too hard.</p><p>
388
389</p></div><hr><div class="refsect2"><h3><a name="xmlSAXLocator"></a>struct xmlSAXLocator</h3><pre class="programlisting">struct xmlSAXLocator {
390
391    const xmlChar *(*getPublicId)(void *ctx);
392    const xmlChar *(*getSystemId)(void *ctx);
393    int (*getLineNumber)(void *ctx);
394    int (*getColumnNumber)(void *ctx);
395};
396</pre><p>
397A SAX Locator.</p><p>
398
399</p></div><hr><div class="refsect2"><h3><a name="resolveEntitySAXFunc"></a>resolveEntitySAXFunc ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> (*resolveEntitySAXFunc)   (void *ctx,
400                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
401                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId);</pre><p>
402Callback:
403The entity loader, to control the loading of external entities,
404the application can either:
405   - override this <GTKDOCLINK HREF="resolveEntity">resolveEntity</GTKDOCLINK>() callback in the SAX block
406   - or better use the <GTKDOCLINK HREF="xmlSetExternalEntityLoader">xmlSetExternalEntityLoader</GTKDOCLINK>() function to
407     set up it's own entity resolution routine</p><p>
408
409</p><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)
410</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td> The public ID of the entity
411</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td> The system ID of the entity
412</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>the xmlParserInputPtr if inlined or NULL for DOM behaviour.
413</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="internalSubsetSAXFunc"></a>internalSubsetSAXFunc ()</h3><pre class="programlisting">void        (*internalSubsetSAXFunc)        (void *ctx,
414                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
415                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ExternalID,
416                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *SystemID);</pre><p>
417Callback on internal subset declaration.</p><p>
418
419</p><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)
420</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  the root element name
421</td></tr><tr><td><span class="term"><i><tt>ExternalID</tt></i>:</span></td><td>  the external ID
422</td></tr><tr><td><span class="term"><i><tt>SystemID</tt></i>:</span></td><td>  the SYSTEM ID (e.g. filename or URL)
423</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="externalSubsetSAXFunc"></a>externalSubsetSAXFunc ()</h3><pre class="programlisting">void        (*externalSubsetSAXFunc)        (void *ctx,
424                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
425                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ExternalID,
426                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *SystemID);</pre><p>
427Callback on external subset declaration.</p><p>
428
429</p><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)
430</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  the root element name
431</td></tr><tr><td><span class="term"><i><tt>ExternalID</tt></i>:</span></td><td>  the external ID
432</td></tr><tr><td><span class="term"><i><tt>SystemID</tt></i>:</span></td><td>  the SYSTEM ID (e.g. filename or URL)
433</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="getEntitySAXFunc"></a>getEntitySAXFunc ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlEntityPtr">xmlEntityPtr</a> (*getEntitySAXFunc)            (void *ctx,
434                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);</pre><p>
435Get an entity by name.</p><p>
436
437</p><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)
438</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td> The entity name
439</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>the xmlEntityPtr if found.
440</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="getParameterEntitySAXFunc"></a>getParameterEntitySAXFunc ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlEntityPtr">xmlEntityPtr</a> (*getParameterEntitySAXFunc)   (void *ctx,
441                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);</pre><p>
442Get a parameter entity by name.</p><p>
443
444</p><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)
445</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td> The entity name
446</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>the xmlEntityPtr if found.
447</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="entityDeclSAXFunc"></a>entityDeclSAXFunc ()</h3><pre class="programlisting">void        (*entityDeclSAXFunc)            (void *ctx,
448                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
449                                             int type,
450                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
451                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId,
452                                             <a href="libxml-tree.html#xmlChar">xmlChar</a> *content);</pre><p>
453An entity definition has been parsed.</p><p>
454
455</p><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)
456</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  the entity name 
457</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>  the entity type 
458</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td> The public ID of the entity
459</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td> The system ID of the entity
460</td></tr><tr><td><span class="term"><i><tt>content</tt></i>:</span></td><td> the entity value (without processing).
461</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="notationDeclSAXFunc"></a>notationDeclSAXFunc ()</h3><pre class="programlisting">void        (*notationDeclSAXFunc)          (void *ctx,
462                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
463                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
464                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId);</pre><p>
465What to do when a notation declaration has been parsed.</p><p>
466
467</p><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)
468</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td> The name of the notation
469</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td> The public ID of the entity
470</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td> The system ID of the entity
471</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="attributeDeclSAXFunc"></a>attributeDeclSAXFunc ()</h3><pre class="programlisting">void        (*attributeDeclSAXFunc)         (void *ctx,
472                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *elem,
473                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *fullname,
474                                             int type,
475                                             int def,
476                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *defaultValue,
477                                             <a href="libxml-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> tree);</pre><p>
478An attribute definition has been parsed.</p><p>
479
480</p><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)
481</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>  the name of the element
482</td></tr><tr><td><span class="term"><i><tt>fullname</tt></i>:</span></td><td>  the attribute name 
483</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>  the attribute type 
484</td></tr><tr><td><span class="term"><i><tt>def</tt></i>:</span></td><td>  the type of default value
485</td></tr><tr><td><span class="term"><i><tt>defaultValue</tt></i>:</span></td><td> the attribute default value
486</td></tr><tr><td><span class="term"><i><tt>tree</tt></i>:</span></td><td>  the tree of enumerated value set
487</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="elementDeclSAXFunc"></a>elementDeclSAXFunc ()</h3><pre class="programlisting">void        (*elementDeclSAXFunc)           (void *ctx,
488                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
489                                             int type,
490                                             <a href="libxml-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> content);</pre><p>
491An element definition has been parsed.</p><p>
492
493</p><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)
494</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  the element name 
495</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>  the element type 
496</td></tr><tr><td><span class="term"><i><tt>content</tt></i>:</span></td><td> the element value tree
497</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="unparsedEntityDeclSAXFunc"></a>unparsedEntityDeclSAXFunc ()</h3><pre class="programlisting">void        (*unparsedEntityDeclSAXFunc)    (void *ctx,
498                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
499                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *publicId,
500                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *systemId,
501                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *notationName);</pre><p>
502What to do when an unparsed entity declaration is parsed.</p><p>
503
504</p><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)
505</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td> The name of the entity
506</td></tr><tr><td><span class="term"><i><tt>publicId</tt></i>:</span></td><td> The public ID of the entity
507</td></tr><tr><td><span class="term"><i><tt>systemId</tt></i>:</span></td><td> The system ID of the entity
508</td></tr><tr><td><span class="term"><i><tt>notationName</tt></i>:</span></td><td> the name of the notation
509</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="setDocumentLocatorSAXFunc"></a>setDocumentLocatorSAXFunc ()</h3><pre class="programlisting">void        (*setDocumentLocatorSAXFunc)    (void *ctx,
510                                             <a href="libxml-tree.html#xmlSAXLocatorPtr">xmlSAXLocatorPtr</a> loc);</pre><p>
511Receive the document locator at startup, actually xmlDefaultSAXLocator.
512Everything is available on the context, so this is useless in our case.</p><p>
513
514</p><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)
515</td></tr><tr><td><span class="term"><i><tt>loc</tt></i>:</span></td><td> A SAX Locator
516</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="startDocumentSAXFunc"></a>startDocumentSAXFunc ()</h3><pre class="programlisting">void        (*startDocumentSAXFunc)         (void *ctx);</pre><p>
517Called when the document start being processed.</p><p>
518
519</p><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)
520</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="endDocumentSAXFunc"></a>endDocumentSAXFunc ()</h3><pre class="programlisting">void        (*endDocumentSAXFunc)           (void *ctx);</pre><p>
521Called when the document end has been detected.</p><p>
522
523</p><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)
524</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="startElementSAXFunc"></a>startElementSAXFunc ()</h3><pre class="programlisting">void        (*startElementSAXFunc)          (void *ctx,
525                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
526                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **atts);</pre><p>
527Called when an opening tag has been processed.</p><p>
528
529</p><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)
530</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  The element name, including namespace prefix
531</td></tr><tr><td><span class="term"><i><tt>atts</tt></i>:</span></td><td>  An array of name/value attributes pairs, NULL terminated
532</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="endElementSAXFunc"></a>endElementSAXFunc ()</h3><pre class="programlisting">void        (*endElementSAXFunc)            (void *ctx,
533                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);</pre><p>
534Called when the end of an element has been detected.</p><p>
535
536</p><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)
537</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  The element name
538</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="attributeSAXFunc"></a>attributeSAXFunc ()</h3><pre class="programlisting">void        (*attributeSAXFunc)             (void *ctx,
539                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name,
540                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);</pre><p>
541Handle an attribute that has been read by the parser.
542The default handling is to convert the attribute into an
543DOM subtree and past it in a new xmlAttr element added to
544the element.</p><p>
545
546</p><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)
547</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  The attribute name, including namespace prefix
548</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>  The attribute value
549</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="referenceSAXFunc"></a>referenceSAXFunc ()</h3><pre class="programlisting">void        (*referenceSAXFunc)             (void *ctx,
550                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *name);</pre><p>
551Called when an entity reference is detected.</p><p>
552
553</p><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)
554</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>  The entity name
555</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="charactersSAXFunc"></a>charactersSAXFunc ()</h3><pre class="programlisting">void        (*charactersSAXFunc)            (void *ctx,
556                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ch,
557                                             int len);</pre><p>
558Receiving some chars from the parser.</p><p>
559
560</p><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)
561</td></tr><tr><td><span class="term"><i><tt>ch</tt></i>:</span></td><td>  a xmlChar string
562</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td> the number of xmlChar
563</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="ignorableWhitespaceSAXFunc"></a>ignorableWhitespaceSAXFunc ()</h3><pre class="programlisting">void        (*ignorableWhitespaceSAXFunc)   (void *ctx,
564                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *ch,
565                                             int len);</pre><p>
566Receiving some ignorable whitespaces from the parser.
567UNUSED: by default the DOM building will use characters.</p><p>
568
569</p><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)
570</td></tr><tr><td><span class="term"><i><tt>ch</tt></i>:</span></td><td>  a xmlChar string
571</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td> the number of xmlChar
572</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="processingInstructionSAXFunc"></a>processingInstructionSAXFunc ()</h3><pre class="programlisting">void        (*processingInstructionSAXFunc) (void *ctx,
573                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *target,
574                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *data);</pre><p>
575A processing instruction has been parsed.</p><p>
576
577</p><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)
578</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>  the target name
579</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td> the PI data's
580</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="commentSAXFunc"></a>commentSAXFunc ()</h3><pre class="programlisting">void        (*commentSAXFunc)               (void *ctx,
581                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);</pre><p>
582A comment has been parsed.</p><p>
583
584</p><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)
585</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>  the comment content
586</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="cdataBlockSAXFunc"></a>cdataBlockSAXFunc ()</h3><pre class="programlisting">void        (*cdataBlockSAXFunc)            (void *ctx,
587                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
588                                             int len);</pre><p>
589Called when a pcdata block has been parsed.</p><p>
590
591</p><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)
592</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>  The pcdata content
593</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>  the block length
594</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="warningSAXFunc"></a>warningSAXFunc ()</h3><pre class="programlisting">void        (*warningSAXFunc)               (void *ctx,
595                                             const char *msg,
596                                             ...);</pre><p>
597Display and format a warning messages, callback.</p><p>
598
599</p><div class="variablelist"><table border="0"><col align="left"><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>  an XML parser context
600</td></tr><tr><td><span class="term"><i><tt>msg</tt></i>:</span></td><td>  the message to display/transmit
601</td></tr><tr><td><span class="term"><i><tt>...</tt></i>:</span></td><td>  extra parameters for the message display
602</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="errorSAXFunc"></a>errorSAXFunc ()</h3><pre class="programlisting">void        (*errorSAXFunc)                 (void *ctx,
603                                             const char *msg,
604                                             ...);</pre><p>
605Display and format an error messages, callback.</p><p>
606
607</p><div class="variablelist"><table border="0"><col align="left"><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>  an XML parser context
608</td></tr><tr><td><span class="term"><i><tt>msg</tt></i>:</span></td><td>  the message to display/transmit
609</td></tr><tr><td><span class="term"><i><tt>...</tt></i>:</span></td><td>  extra parameters for the message display
610</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="fatalErrorSAXFunc"></a>fatalErrorSAXFunc ()</h3><pre class="programlisting">void        (*fatalErrorSAXFunc)            (void *ctx,
611                                             const char *msg,
612                                             ...);</pre><p>
613Display and format fatal error messages, callback.
614Note: so far <GTKDOCLINK HREF="fatalError">fatalError</GTKDOCLINK>() SAX callbacks are not used, <GTKDOCLINK HREF="error">error</GTKDOCLINK>()
615      get all the callbacks for errors.</p><p>
616
617</p><div class="variablelist"><table border="0"><col align="left"><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>  an XML parser context
618</td></tr><tr><td><span class="term"><i><tt>msg</tt></i>:</span></td><td>  the message to display/transmit
619</td></tr><tr><td><span class="term"><i><tt>...</tt></i>:</span></td><td>  extra parameters for the message display
620</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="isStandaloneSAXFunc"></a>isStandaloneSAXFunc ()</h3><pre class="programlisting">int         (*isStandaloneSAXFunc)          (void *ctx);</pre><p>
621Is this document tagged standalone?</p><p>
622
623</p><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)
624</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>1 if true
625</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="hasInternalSubsetSAXFunc"></a>hasInternalSubsetSAXFunc ()</h3><pre class="programlisting">int         (*hasInternalSubsetSAXFunc)     (void *ctx);</pre><p>
626Does this document has an internal subset.</p><p>
627
628</p><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)
629</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>1 if true
630</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="hasExternalSubsetSAXFunc"></a>hasExternalSubsetSAXFunc ()</h3><pre class="programlisting">int         (*hasExternalSubsetSAXFunc)     (void *ctx);</pre><p>
631Does this document has an external subset?</p><p>
632
633</p><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)
634</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>1 if true
635</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="XML-SAX2-MAGIC-CAPS"></a>XML_SAX2_MAGIC</h3><pre class="programlisting">#define XML_SAX2_MAGIC 0xDEEDBEAF
636</pre><p>
637Special constant found in SAX2 blocks initialized fields</p><p>
638
639</p></div><hr><div class="refsect2"><h3><a name="startElementNsSAX2Func"></a>startElementNsSAX2Func ()</h3><pre class="programlisting">void        (*startElementNsSAX2Func)       (void *ctx,
640                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *localname,
641                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *prefix,
642                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI,
643                                             int nb_namespaces,
644                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **namespaces,
645                                             int nb_attributes,
646                                             int nb_defaulted,
647                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> **attributes);</pre><p>
648SAX2 callback when an element start has been detected by the parser.
649It provides the namespace informations for the element, as well as
650the new namespace declarations on the element.</p><p>
651
652</p><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)
653</td></tr><tr><td><span class="term"><i><tt>localname</tt></i>:</span></td><td>  the local name of the element
654</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>  the element namespace prefix if available
655</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>  the element namespace name if available
656</td></tr><tr><td><span class="term"><i><tt>nb_namespaces</tt></i>:</span></td><td>  number of namespace definitions on that node
657</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
658</td></tr><tr><td><span class="term"><i><tt>nb_attributes</tt></i>:</span></td><td>  the number of attributes on that node
659</td></tr><tr><td><span class="term"><i><tt>nb_defaulted</tt></i>:</span></td><td>  the number of defaulted attributes. The defaulted
660                 ones are at the end of the array
661</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)
662              attribute values.
663</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="endElementNsSAX2Func"></a>endElementNsSAX2Func ()</h3><pre class="programlisting">void        (*endElementNsSAX2Func)         (void *ctx,
664                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *localname,
665                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *prefix,
666                                             const <a href="libxml-tree.html#xmlChar">xmlChar</a> *URI);</pre><p>
667SAX2 callback when an element end has been detected by the parser.
668It provides the namespace informations for the element.</p><p>
669
670</p><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)
671</td></tr><tr><td><span class="term"><i><tt>localname</tt></i>:</span></td><td>  the local name of the element
672</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>  the element namespace prefix if available
673</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>  the element namespace name if available
674</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="xmlSAXHandler"></a>struct xmlSAXHandler</h3><pre class="programlisting">struct xmlSAXHandler {
675
676    internalSubsetSAXFunc internalSubset;
677    isStandaloneSAXFunc isStandalone;
678    hasInternalSubsetSAXFunc hasInternalSubset;
679    hasExternalSubsetSAXFunc hasExternalSubset;
680    resolveEntitySAXFunc resolveEntity;
681    getEntitySAXFunc getEntity;
682    entityDeclSAXFunc entityDecl;
683    notationDeclSAXFunc notationDecl;
684    attributeDeclSAXFunc attributeDecl;
685    elementDeclSAXFunc elementDecl;
686    unparsedEntityDeclSAXFunc unparsedEntityDecl;
687    setDocumentLocatorSAXFunc setDocumentLocator;
688    startDocumentSAXFunc startDocument;
689    endDocumentSAXFunc endDocument;
690    startElementSAXFunc startElement;
691    endElementSAXFunc endElement;
692    referenceSAXFunc reference;
693    charactersSAXFunc characters;
694    ignorableWhitespaceSAXFunc ignorableWhitespace;
695    processingInstructionSAXFunc processingInstruction;
696    commentSAXFunc comment;
697    warningSAXFunc warning;
698    errorSAXFunc error;
699    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
700    getParameterEntitySAXFunc getParameterEntity;
701    cdataBlockSAXFunc cdataBlock;
702    externalSubsetSAXFunc externalSubset;
703    unsigned int initialized;
704    /* The following fields are extensions available only on version 2 */
705    void *_private;
706    startElementNsSAX2Func startElementNs;
707    endElementNsSAX2Func endElementNs;
708    xmlStructuredErrorFunc serror;
709};
710</pre><p>
711A SAX handler is bunch of callbacks called by the parser when processing
712of the input generate data or structure informations.</p><p>
713
714</p></div><hr><div class="refsect2"><h3><a name="xmlSAXHandlerV1"></a>struct xmlSAXHandlerV1</h3><pre class="programlisting">struct xmlSAXHandlerV1 {
715
716    internalSubsetSAXFunc internalSubset;
717    isStandaloneSAXFunc isStandalone;
718    hasInternalSubsetSAXFunc hasInternalSubset;
719    hasExternalSubsetSAXFunc hasExternalSubset;
720    resolveEntitySAXFunc resolveEntity;
721    getEntitySAXFunc getEntity;
722    entityDeclSAXFunc entityDecl;
723    notationDeclSAXFunc notationDecl;
724    attributeDeclSAXFunc attributeDecl;
725    elementDeclSAXFunc elementDecl;
726    unparsedEntityDeclSAXFunc unparsedEntityDecl;
727    setDocumentLocatorSAXFunc setDocumentLocator;
728    startDocumentSAXFunc startDocument;
729    endDocumentSAXFunc endDocument;
730    startElementSAXFunc startElement;
731    endElementSAXFunc endElement;
732    referenceSAXFunc reference;
733    charactersSAXFunc characters;
734    ignorableWhitespaceSAXFunc ignorableWhitespace;
735    processingInstructionSAXFunc processingInstruction;
736    commentSAXFunc comment;
737    warningSAXFunc warning;
738    errorSAXFunc error;
739    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
740    getParameterEntitySAXFunc getParameterEntity;
741    cdataBlockSAXFunc cdataBlock;
742    externalSubsetSAXFunc externalSubset;
743    unsigned int initialized;
744};
745</pre><p>
746
747</p></div><hr><div class="refsect2"><h3><a name="xmlSAXHandlerV1Ptr"></a>xmlSAXHandlerV1Ptr</h3><pre class="programlisting">typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
748</pre><p>
749
750</p></div><hr><div class="refsect2"><h3><a name="xmlExternalEntityLoader"></a>xmlExternalEntityLoader ()</h3><pre class="programlisting"><a href="libxml-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> (*xmlExternalEntityLoader)
751                                            (const char *URL,
752                                             const char *ID,
753                                             <a href="libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> context);</pre><p>
754External entity loaders types.</p><p>
755
756</p><div class="variablelist"><table border="0"><col align="left"><tbody><tr><td><span class="term"><i><tt>URL</tt></i>:</span></td><td> The System ID of the resource requested
757</td></tr><tr><td><span class="term"><i><tt>ID</tt></i>:</span></td><td> The Public ID of the resource requested
758</td></tr><tr><td><span class="term"><i><tt>context</tt></i>:</span></td><td> the XML parser context 
759</td></tr><tr><td><span class="term"><span class="emphasis"><i>Returns</i></span> :</span></td><td>the entity input parser.
760</td></tr></tbody></table></div></div><hr><div class="refsect2"><h3><a name="xmlParserOption"></a>enum xmlParserOption</h3><pre class="programlisting">typedef enum {
761    XML_PARSE_RECOVER	= 1&lt;&lt;0,	/* recover on errors */
762    XML_PARSE_NOENT	= 1&lt;&lt;1,	/* substitute entities */
763    XML_PARSE_DTDLOAD	= 1&lt;&lt;2,	/* load the external subset */
764    XML_PARSE_DTDATTR	= 1&lt;&lt;3,	/* default DTD attributes */
765    XML_PARSE_DTDVALID	= 1&lt;&lt;4,	/* validate with the DTD */
766    XML_PARSE_NOERROR	= 1&lt;&lt;5,	/* suppress error reports */
767    XML_PARSE_NOWARNING	= 1&lt;&lt;6,	/* suppress warning reports */
768    XML_PARSE_PEDANTIC	= 1&lt;&lt;7,	/* pedantic error reporting */
769    XML_PARSE_NOBLANKS	= 1&lt;&lt;8,	/* remove blank nodes */
770    XML_PARSE_SAX1	= 1&lt;&lt;9,	/* use the SAX1 interface internally */
771    XML_PARSE_XINCLUDE	= 1&lt;&lt;10,/* Implement XInclude substitition  */
772    XML_PARSE_NONET	= 1&lt;&lt;11,/* Forbid network access */
773    XML_PARSE_NODICT	= 1&lt;&lt;12,/* Do not reuse the context dictionnary */
774    XML_PARSE_NSCLEAN	= 1&lt;&lt;13,/* remove redundant namespaces declarations */
775    XML_PARSE_NOCDATA	= 1&lt;&lt;14 /* merge CDATA as text nodes */
776} xmlParserOption;
777</pre><p>
778This is the set of XML parser options that can be passed down
779to the <GTKDOCLINK HREF="xmlReadDoc">xmlReadDoc</GTKDOCLINK>() and similar calls.</p><p>
780
781</p></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-threads.html"><b>&lt;&lt;�threads</b></a></td><td align="right"><a accesskey="n" href="libxml-c14n.html"><b>c14n�&gt;&gt;</b></a></td></tr></table></body></html>
782