1 /* libxml2 - Library for parsing XML documents
2  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3  *
4  * This file is not part of the GNU gettext program, but is used with
5  * GNU gettext.
6  *
7  * The original copyright notice is as follows:
8  */
9 
10 /*
11  * Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is fur-
18  * nished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25  * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29  * THE SOFTWARE.
30  *
31  * Author: Daniel Veillard
32  */
33 
34 /*
35  * Summary: the core parser module
36  * Description: Interfaces, constants and types related to the XML parser
37  */
38 
39 #ifndef __XML_PARSER_H__
40 #define __XML_PARSER_H__
41 
42 #include <stdarg.h>
43 
44 #include <libxml/xmlversion.h>
45 #include <libxml/tree.h>
46 #include <libxml/dict.h>
47 #include <libxml/hash.h>
48 #include <libxml/valid.h>
49 #include <libxml/entities.h>
50 #include <libxml/xmlerror.h>
51 #include <libxml/xmlstring.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**
58  * XML_DEFAULT_VERSION:
59  *
60  * The default version of XML used: 1.0
61  */
62 #define XML_DEFAULT_VERSION	"1.0"
63 
64 /**
65  * xmlParserInput:
66  *
67  * An xmlParserInput is an input flow for the XML processor.
68  * Each entity parsed is associated an xmlParserInput (except the
69  * few predefined ones). This is the case both for internal entities
70  * - in which case the flow is already completely in memory - or
71  * external entities - in which case we use the buf structure for
72  * progressive reading and I18N conversions to the internal UTF-8 format.
73  */
74 
75 /**
76  * xmlParserInputDeallocate:
77  * @str:  the string to deallocate
78  *
79  * Callback for freeing some parser input allocations.
80  */
81 typedef void (* xmlParserInputDeallocate)(xmlChar *str);
82 
83 struct _xmlParserInput {
84     /* Input buffer */
85     xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
86 
87     const char *filename;             /* The file analyzed, if any */
88     const char *directory;            /* the directory/base of the file */
89     const xmlChar *base;              /* Base of the array to parse */
90     const xmlChar *cur;               /* Current char being parsed */
91     const xmlChar *end;               /* end of the array to parse */
92     int length;                       /* length if known */
93     int line;                         /* Current line */
94     int col;                          /* Current column */
95     /*
96      * NOTE: consumed is only tested for equality in the parser code,
97      *       so even if there is an overflow this should not give troubles
98      *       for parsing very large instances.
99      */
100     unsigned long consumed;           /* How many xmlChars already consumed */
101     xmlParserInputDeallocate free;    /* function to deallocate the base */
102     const xmlChar *encoding;          /* the encoding string for entity */
103     const xmlChar *version;           /* the version string for entity */
104     int standalone;                   /* Was that entity marked standalone */
105     int id;                           /* an unique identifier for the entity */
106 };
107 
108 /**
109  * xmlParserNodeInfo:
110  *
111  * The parser can be asked to collect Node informations, i.e. at what
112  * place in the file they were detected.
113  * NOTE: This is off by default and not very well tested.
114  */
115 typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
116 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
117 
118 struct _xmlParserNodeInfo {
119   const struct _xmlNode* node;
120   /* Position & line # that text that created the node begins & ends on */
121   unsigned long begin_pos;
122   unsigned long begin_line;
123   unsigned long end_pos;
124   unsigned long end_line;
125 };
126 
127 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
128 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
129 struct _xmlParserNodeInfoSeq {
130   unsigned long maximum;
131   unsigned long length;
132   xmlParserNodeInfo* buffer;
133 };
134 
135 /**
136  * xmlParserInputState:
137  *
138  * The parser is now working also as a state based parser.
139  * The recursive one use the state info for entities processing.
140  */
141 typedef enum {
142     XML_PARSER_EOF = -1,	/* nothing is to be parsed */
143     XML_PARSER_START = 0,	/* nothing has been parsed */
144     XML_PARSER_MISC,		/* Misc* before int subset */
145     XML_PARSER_PI,		/* Within a processing instruction */
146     XML_PARSER_DTD,		/* within some DTD content */
147     XML_PARSER_PROLOG,		/* Misc* after internal subset */
148     XML_PARSER_COMMENT,		/* within a comment */
149     XML_PARSER_START_TAG,	/* within a start tag */
150     XML_PARSER_CONTENT,		/* within the content */
151     XML_PARSER_CDATA_SECTION,	/* within a CDATA section */
152     XML_PARSER_END_TAG,		/* within a closing tag */
153     XML_PARSER_ENTITY_DECL,	/* within an entity declaration */
154     XML_PARSER_ENTITY_VALUE,	/* within an entity value in a decl */
155     XML_PARSER_ATTRIBUTE_VALUE,	/* within an attribute value */
156     XML_PARSER_SYSTEM_LITERAL,	/* within a SYSTEM value */
157     XML_PARSER_EPILOG,		/* the Misc* after the last end tag */
158     XML_PARSER_IGNORE,		/* within an IGNORED section */
159     XML_PARSER_PUBLIC_LITERAL	/* within a PUBLIC value */
160 } xmlParserInputState;
161 
162 /**
163  * XML_DETECT_IDS:
164  *
165  * Bit in the loadsubset context field to tell to do ID/REFs lookups.
166  * Use it to initialize xmlLoadExtDtdDefaultValue.
167  */
168 #define XML_DETECT_IDS		2
169 
170 /**
171  * XML_COMPLETE_ATTRS:
172  *
173  * Bit in the loadsubset context field to tell to do complete the
174  * elements attributes lists with the ones defaulted from the DTDs.
175  * Use it to initialize xmlLoadExtDtdDefaultValue.
176  */
177 #define XML_COMPLETE_ATTRS	4
178 
179 /**
180  * XML_SKIP_IDS:
181  *
182  * Bit in the loadsubset context field to tell to not do ID/REFs registration.
183  * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
184  */
185 #define XML_SKIP_IDS		8
186 
187 /**
188  * xmlParserMode:
189  *
190  * A parser can operate in various modes
191  */
192 typedef enum {
193     XML_PARSE_UNKNOWN = 0,
194     XML_PARSE_DOM = 1,
195     XML_PARSE_SAX = 2,
196     XML_PARSE_PUSH_DOM = 3,
197     XML_PARSE_PUSH_SAX = 4,
198     XML_PARSE_READER = 5
199 } xmlParserMode;
200 
201 /**
202  * xmlParserCtxt:
203  *
204  * The parser context.
205  * NOTE This doesn't completely define the parser state, the (current ?)
206  *      design of the parser uses recursive function calls since this allow
207  *      and easy mapping from the production rules of the specification
208  *      to the actual code. The drawback is that the actual function call
209  *      also reflect the parser state. However most of the parsing routines
210  *      takes as the only argument the parser context pointer, so migrating
211  *      to a state based parser for progressive parsing shouldn't be too hard.
212  */
213 struct _xmlParserCtxt {
214     struct _xmlSAXHandler *sax;       /* The SAX handler */
215     void            *userData;        /* For SAX interface only, used by DOM build */
216     xmlDocPtr           myDoc;        /* the document being built */
217     int            wellFormed;        /* is the document well formed */
218     int       replaceEntities;        /* shall we replace entities ? */
219     const xmlChar    *version;        /* the XML version string */
220     const xmlChar   *encoding;        /* the declared encoding, if any */
221     int            standalone;        /* standalone document */
222     int                  html;        /* an HTML(1)/Docbook(2) document
223                                        * 3 is HTML after <head>
224                                        * 10 is HTML after <body>
225                                        */
226 
227     /* Input stream stack */
228     xmlParserInputPtr  input;         /* Current input stream */
229     int                inputNr;       /* Number of current input streams */
230     int                inputMax;      /* Max number of input streams */
231     xmlParserInputPtr *inputTab;      /* stack of inputs */
232 
233     /* Node analysis stack only used for DOM building */
234     xmlNodePtr         node;          /* Current parsed Node */
235     int                nodeNr;        /* Depth of the parsing stack */
236     int                nodeMax;       /* Max depth of the parsing stack */
237     xmlNodePtr        *nodeTab;       /* array of nodes */
238 
239     int record_info;                  /* Whether node info should be kept */
240     xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
241 
242     int errNo;                        /* error code */
243 
244     int     hasExternalSubset;        /* reference and external subset */
245     int             hasPErefs;        /* the internal subset has PE refs */
246     int              external;        /* are we parsing an external entity */
247 
248     int                 valid;        /* is the document valid */
249     int              validate;        /* shall we try to validate ? */
250     xmlValidCtxt        vctxt;        /* The validity context */
251 
252     xmlParserInputState instate;      /* current type of input */
253     int                 token;        /* next char look-ahead */
254 
255     char           *directory;        /* the data directory */
256 
257     /* Node name stack */
258     const xmlChar     *name;          /* Current parsed Node */
259     int                nameNr;        /* Depth of the parsing stack */
260     int                nameMax;       /* Max depth of the parsing stack */
261     const xmlChar *   *nameTab;       /* array of nodes */
262 
263     long               nbChars;       /* number of xmlChar processed */
264     long            checkIndex;       /* used by progressive parsing lookup */
265     int             keepBlanks;       /* ugly but ... */
266     int             disableSAX;       /* SAX callbacks are disabled */
267     int               inSubset;       /* Parsing is in int 1/ext 2 subset */
268     const xmlChar *    intSubName;    /* name of subset */
269     xmlChar *          extSubURI;     /* URI of external subset */
270     xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
271 
272     /* xml:space values */
273     int *              space;         /* Should the parser preserve spaces */
274     int                spaceNr;       /* Depth of the parsing stack */
275     int                spaceMax;      /* Max depth of the parsing stack */
276     int *              spaceTab;      /* array of space infos */
277 
278     int                depth;         /* to prevent entity substitution loops */
279     xmlParserInputPtr  entity;        /* used to check entities boundaries */
280     int                charset;       /* encoding of the in-memory content
281 				         actually an xmlCharEncoding */
282     int                nodelen;       /* Those two fields are there to */
283     int                nodemem;       /* Speed up large node parsing */
284     int                pedantic;      /* signal pedantic warnings */
285     void              *_private;      /* For user data, libxml won't touch it */
286 
287     int                loadsubset;    /* should the external subset be loaded */
288     int                linenumbers;   /* set line number in element content */
289     void              *catalogs;      /* document's own catalog */
290     int                recovery;      /* run in recovery mode */
291     int                progressive;   /* is this a progressive parsing */
292     xmlDictPtr         dict;          /* dictionary for the parser */
293     const xmlChar *   *atts;          /* array for the attributes callbacks */
294     int                maxatts;       /* the size of the array */
295     int                docdict;       /* use strings from dict to build tree */
296 
297     /*
298      * pre-interned strings
299      */
300     const xmlChar *str_xml;
301     const xmlChar *str_xmlns;
302     const xmlChar *str_xml_ns;
303 
304     /*
305      * Everything below is used only by the new SAX mode
306      */
307     int                sax2;          /* operating in the new SAX mode */
308     int                nsNr;          /* the number of inherited namespaces */
309     int                nsMax;         /* the size of the arrays */
310     const xmlChar *   *nsTab;         /* the array of prefix/namespace name */
311     int               *attallocs;     /* which attribute were allocated */
312     void *            *pushTab;       /* array of data for push */
313     xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */
314     xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */
315     int                nsWellFormed;  /* is the document XML Nanespace okay */
316     int                options;       /* Extra options */
317 
318     /*
319      * Those fields are needed only for treaming parsing so far
320      */
321     int               dictNames;    /* Use dictionary names for the tree */
322     int               freeElemsNr;  /* number of freed element nodes */
323     xmlNodePtr        freeElems;    /* List of freed element nodes */
324     int               freeAttrsNr;  /* number of freed attributes nodes */
325     xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */
326 
327     /*
328      * the complete error informations for the last error.
329      */
330     xmlError          lastError;
331     xmlParserMode     parseMode;    /* the parser mode */
332     unsigned long    nbentities;    /* number of entities references */
333     unsigned long  sizeentities;    /* size of parsed entities */
334 
335     /* for use by HTML non-recursive parser */
336     xmlParserNodeInfo *nodeInfo;      /* Current NodeInfo */
337     int                nodeInfoNr;    /* Depth of the parsing stack */
338     int                nodeInfoMax;   /* Max depth of the parsing stack */
339     xmlParserNodeInfo *nodeInfoTab;   /* array of nodeInfos */
340 
341     int                input_id;      /* we need to label inputs */
342     unsigned long      sizeentcopy;   /* volume of entity copy */
343 };
344 
345 /**
346  * xmlSAXLocator:
347  *
348  * A SAX Locator.
349  */
350 struct _xmlSAXLocator {
351     const xmlChar *(*getPublicId)(void *ctx);
352     const xmlChar *(*getSystemId)(void *ctx);
353     int (*getLineNumber)(void *ctx);
354     int (*getColumnNumber)(void *ctx);
355 };
356 
357 /**
358  * xmlSAXHandler:
359  *
360  * A SAX handler is bunch of callbacks called by the parser when processing
361  * of the input generate data or structure informations.
362  */
363 
364 /**
365  * resolveEntitySAXFunc:
366  * @ctx:  the user data (XML parser context)
367  * @publicId: The public ID of the entity
368  * @systemId: The system ID of the entity
369  *
370  * Callback:
371  * The entity loader, to control the loading of external entities,
372  * the application can either:
373  *    - override this resolveEntity() callback in the SAX block
374  *    - or better use the xmlSetExternalEntityLoader() function to
375  *      set up it's own entity resolution routine
376  *
377  * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
378  */
379 typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
380 				const xmlChar *publicId,
381 				const xmlChar *systemId);
382 /**
383  * internalSubsetSAXFunc:
384  * @ctx:  the user data (XML parser context)
385  * @name:  the root element name
386  * @ExternalID:  the external ID
387  * @SystemID:  the SYSTEM ID (e.g. filename or URL)
388  *
389  * Callback on internal subset declaration.
390  */
391 typedef void (*internalSubsetSAXFunc) (void *ctx,
392 				const xmlChar *name,
393 				const xmlChar *ExternalID,
394 				const xmlChar *SystemID);
395 /**
396  * externalSubsetSAXFunc:
397  * @ctx:  the user data (XML parser context)
398  * @name:  the root element name
399  * @ExternalID:  the external ID
400  * @SystemID:  the SYSTEM ID (e.g. filename or URL)
401  *
402  * Callback on external subset declaration.
403  */
404 typedef void (*externalSubsetSAXFunc) (void *ctx,
405 				const xmlChar *name,
406 				const xmlChar *ExternalID,
407 				const xmlChar *SystemID);
408 /**
409  * getEntitySAXFunc:
410  * @ctx:  the user data (XML parser context)
411  * @name: The entity name
412  *
413  * Get an entity by name.
414  *
415  * Returns the xmlEntityPtr if found.
416  */
417 typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
418 				const xmlChar *name);
419 /**
420  * getParameterEntitySAXFunc:
421  * @ctx:  the user data (XML parser context)
422  * @name: The entity name
423  *
424  * Get a parameter entity by name.
425  *
426  * Returns the xmlEntityPtr if found.
427  */
428 typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
429 				const xmlChar *name);
430 /**
431  * entityDeclSAXFunc:
432  * @ctx:  the user data (XML parser context)
433  * @name:  the entity name
434  * @type:  the entity type
435  * @publicId: The public ID of the entity
436  * @systemId: The system ID of the entity
437  * @content: the entity value (without processing).
438  *
439  * An entity definition has been parsed.
440  */
441 typedef void (*entityDeclSAXFunc) (void *ctx,
442 				const xmlChar *name,
443 				int type,
444 				const xmlChar *publicId,
445 				const xmlChar *systemId,
446 				xmlChar *content);
447 /**
448  * notationDeclSAXFunc:
449  * @ctx:  the user data (XML parser context)
450  * @name: The name of the notation
451  * @publicId: The public ID of the entity
452  * @systemId: The system ID of the entity
453  *
454  * What to do when a notation declaration has been parsed.
455  */
456 typedef void (*notationDeclSAXFunc)(void *ctx,
457 				const xmlChar *name,
458 				const xmlChar *publicId,
459 				const xmlChar *systemId);
460 /**
461  * attributeDeclSAXFunc:
462  * @ctx:  the user data (XML parser context)
463  * @elem:  the name of the element
464  * @fullname:  the attribute name
465  * @type:  the attribute type
466  * @def:  the type of default value
467  * @defaultValue: the attribute default value
468  * @tree:  the tree of enumerated value set
469  *
470  * An attribute definition has been parsed.
471  */
472 typedef void (*attributeDeclSAXFunc)(void *ctx,
473 				const xmlChar *elem,
474 				const xmlChar *fullname,
475 				int type,
476 				int def,
477 				const xmlChar *defaultValue,
478 				xmlEnumerationPtr tree);
479 /**
480  * elementDeclSAXFunc:
481  * @ctx:  the user data (XML parser context)
482  * @name:  the element name
483  * @type:  the element type
484  * @content: the element value tree
485  *
486  * An element definition has been parsed.
487  */
488 typedef void (*elementDeclSAXFunc)(void *ctx,
489 				const xmlChar *name,
490 				int type,
491 				xmlElementContentPtr content);
492 /**
493  * unparsedEntityDeclSAXFunc:
494  * @ctx:  the user data (XML parser context)
495  * @name: The name of the entity
496  * @publicId: The public ID of the entity
497  * @systemId: The system ID of the entity
498  * @notationName: the name of the notation
499  *
500  * What to do when an unparsed entity declaration is parsed.
501  */
502 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
503 				const xmlChar *name,
504 				const xmlChar *publicId,
505 				const xmlChar *systemId,
506 				const xmlChar *notationName);
507 /**
508  * setDocumentLocatorSAXFunc:
509  * @ctx:  the user data (XML parser context)
510  * @loc: A SAX Locator
511  *
512  * Receive the document locator at startup, actually xmlDefaultSAXLocator.
513  * Everything is available on the context, so this is useless in our case.
514  */
515 typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
516 				xmlSAXLocatorPtr loc);
517 /**
518  * startDocumentSAXFunc:
519  * @ctx:  the user data (XML parser context)
520  *
521  * Called when the document start being processed.
522  */
523 typedef void (*startDocumentSAXFunc) (void *ctx);
524 /**
525  * endDocumentSAXFunc:
526  * @ctx:  the user data (XML parser context)
527  *
528  * Called when the document end has been detected.
529  */
530 typedef void (*endDocumentSAXFunc) (void *ctx);
531 /**
532  * startElementSAXFunc:
533  * @ctx:  the user data (XML parser context)
534  * @name:  The element name, including namespace prefix
535  * @atts:  An array of name/value attributes pairs, NULL terminated
536  *
537  * Called when an opening tag has been processed.
538  */
539 typedef void (*startElementSAXFunc) (void *ctx,
540 				const xmlChar *name,
541 				const xmlChar **atts);
542 /**
543  * endElementSAXFunc:
544  * @ctx:  the user data (XML parser context)
545  * @name:  The element name
546  *
547  * Called when the end of an element has been detected.
548  */
549 typedef void (*endElementSAXFunc) (void *ctx,
550 				const xmlChar *name);
551 /**
552  * attributeSAXFunc:
553  * @ctx:  the user data (XML parser context)
554  * @name:  The attribute name, including namespace prefix
555  * @value:  The attribute value
556  *
557  * Handle an attribute that has been read by the parser.
558  * The default handling is to convert the attribute into an
559  * DOM subtree and past it in a new xmlAttr element added to
560  * the element.
561  */
562 typedef void (*attributeSAXFunc) (void *ctx,
563 				const xmlChar *name,
564 				const xmlChar *value);
565 /**
566  * referenceSAXFunc:
567  * @ctx:  the user data (XML parser context)
568  * @name:  The entity name
569  *
570  * Called when an entity reference is detected.
571  */
572 typedef void (*referenceSAXFunc) (void *ctx,
573 				const xmlChar *name);
574 /**
575  * charactersSAXFunc:
576  * @ctx:  the user data (XML parser context)
577  * @ch:  a xmlChar string
578  * @len: the number of xmlChar
579  *
580  * Receiving some chars from the parser.
581  */
582 typedef void (*charactersSAXFunc) (void *ctx,
583 				const xmlChar *ch,
584 				int len);
585 /**
586  * ignorableWhitespaceSAXFunc:
587  * @ctx:  the user data (XML parser context)
588  * @ch:  a xmlChar string
589  * @len: the number of xmlChar
590  *
591  * Receiving some ignorable whitespaces from the parser.
592  * UNUSED: by default the DOM building will use characters.
593  */
594 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
595 				const xmlChar *ch,
596 				int len);
597 /**
598  * processingInstructionSAXFunc:
599  * @ctx:  the user data (XML parser context)
600  * @target:  the target name
601  * @data: the PI data's
602  *
603  * A processing instruction has been parsed.
604  */
605 typedef void (*processingInstructionSAXFunc) (void *ctx,
606 				const xmlChar *target,
607 				const xmlChar *data);
608 /**
609  * commentSAXFunc:
610  * @ctx:  the user data (XML parser context)
611  * @value:  the comment content
612  *
613  * A comment has been parsed.
614  */
615 typedef void (*commentSAXFunc) (void *ctx,
616 				const xmlChar *value);
617 /**
618  * cdataBlockSAXFunc:
619  * @ctx:  the user data (XML parser context)
620  * @value:  The pcdata content
621  * @len:  the block length
622  *
623  * Called when a pcdata block has been parsed.
624  */
625 typedef void (*cdataBlockSAXFunc) (
626 	                        void *ctx,
627 				const xmlChar *value,
628 				int len);
629 /**
630  * warningSAXFunc:
631  * @ctx:  an XML parser context
632  * @msg:  the message to display/transmit
633  * @...:  extra parameters for the message display
634  *
635  * Display and format a warning messages, callback.
636  */
637 typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
638 				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
639 /**
640  * errorSAXFunc:
641  * @ctx:  an XML parser context
642  * @msg:  the message to display/transmit
643  * @...:  extra parameters for the message display
644  *
645  * Display and format an error messages, callback.
646  */
647 typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
648 				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
649 /**
650  * fatalErrorSAXFunc:
651  * @ctx:  an XML parser context
652  * @msg:  the message to display/transmit
653  * @...:  extra parameters for the message display
654  *
655  * Display and format fatal error messages, callback.
656  * Note: so far fatalError() SAX callbacks are not used, error()
657  *       get all the callbacks for errors.
658  */
659 typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
660 				const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
661 /**
662  * isStandaloneSAXFunc:
663  * @ctx:  the user data (XML parser context)
664  *
665  * Is this document tagged standalone?
666  *
667  * Returns 1 if true
668  */
669 typedef int (*isStandaloneSAXFunc) (void *ctx);
670 /**
671  * hasInternalSubsetSAXFunc:
672  * @ctx:  the user data (XML parser context)
673  *
674  * Does this document has an internal subset.
675  *
676  * Returns 1 if true
677  */
678 typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
679 
680 /**
681  * hasExternalSubsetSAXFunc:
682  * @ctx:  the user data (XML parser context)
683  *
684  * Does this document has an external subset?
685  *
686  * Returns 1 if true
687  */
688 typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
689 
690 /************************************************************************
691  *									*
692  *			The SAX version 3 API extensions		*
693  *									*
694  ************************************************************************/
695 /**
696  * XML_SAX2_MAGIC:
697  *
698  * Special constant found in SAX2 blocks initialized fields
699  */
700 #define XML_SAX2_MAGIC 0xDEEDBEAF
701 
702 /**
703  * startElementNsSAX2Func:
704  * @ctx:  the user data (XML parser context)
705  * @localname:  the local name of the element
706  * @prefix:  the element namespace prefix if available
707  * @URI:  the element namespace name if available
708  * @nb_namespaces:  number of namespace definitions on that node
709  * @namespaces:  pointer to the array of prefix/URI pairs namespace definitions
710  * @nb_attributes:  the number of attributes on that node
711  * @nb_defaulted:  the number of defaulted attributes. The defaulted
712  *                  ones are at the end of the array
713  * @attributes:  pointer to the array of (localname/prefix/URI/value/end)
714  *               attribute values.
715  *
716  * SAX2 callback when an element start has been detected by the parser.
717  * It provides the namespace informations for the element, as well as
718  * the new namespace declarations on the element.
719  */
720 
721 typedef void (*startElementNsSAX2Func) (void *ctx,
722 					const xmlChar *localname,
723 					const xmlChar *prefix,
724 					const xmlChar *URI,
725 					int nb_namespaces,
726 					const xmlChar **namespaces,
727 					int nb_attributes,
728 					int nb_defaulted,
729 					const xmlChar **attributes);
730 
731 /**
732  * endElementNsSAX2Func:
733  * @ctx:  the user data (XML parser context)
734  * @localname:  the local name of the element
735  * @prefix:  the element namespace prefix if available
736  * @URI:  the element namespace name if available
737  *
738  * SAX2 callback when an element end has been detected by the parser.
739  * It provides the namespace informations for the element.
740  */
741 
742 typedef void (*endElementNsSAX2Func)   (void *ctx,
743 					const xmlChar *localname,
744 					const xmlChar *prefix,
745 					const xmlChar *URI);
746 
747 
748 struct _xmlSAXHandler {
749     internalSubsetSAXFunc internalSubset;
750     isStandaloneSAXFunc isStandalone;
751     hasInternalSubsetSAXFunc hasInternalSubset;
752     hasExternalSubsetSAXFunc hasExternalSubset;
753     resolveEntitySAXFunc resolveEntity;
754     getEntitySAXFunc getEntity;
755     entityDeclSAXFunc entityDecl;
756     notationDeclSAXFunc notationDecl;
757     attributeDeclSAXFunc attributeDecl;
758     elementDeclSAXFunc elementDecl;
759     unparsedEntityDeclSAXFunc unparsedEntityDecl;
760     setDocumentLocatorSAXFunc setDocumentLocator;
761     startDocumentSAXFunc startDocument;
762     endDocumentSAXFunc endDocument;
763     startElementSAXFunc startElement;
764     endElementSAXFunc endElement;
765     referenceSAXFunc reference;
766     charactersSAXFunc characters;
767     ignorableWhitespaceSAXFunc ignorableWhitespace;
768     processingInstructionSAXFunc processingInstruction;
769     commentSAXFunc comment;
770     warningSAXFunc warning;
771     errorSAXFunc error;
772     fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
773     getParameterEntitySAXFunc getParameterEntity;
774     cdataBlockSAXFunc cdataBlock;
775     externalSubsetSAXFunc externalSubset;
776     unsigned int initialized;
777     /* The following fields are extensions available only on version 3 */
778     void *_private;
779     startElementNsSAX2Func startElementNs;
780     endElementNsSAX2Func endElementNs;
781     xmlStructuredErrorFunc serror;
782 };
783 
784 /*
785  * SAX Version 1
786  */
787 typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
788 typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
789 struct _xmlSAXHandlerV1 {
790     internalSubsetSAXFunc internalSubset;
791     isStandaloneSAXFunc isStandalone;
792     hasInternalSubsetSAXFunc hasInternalSubset;
793     hasExternalSubsetSAXFunc hasExternalSubset;
794     resolveEntitySAXFunc resolveEntity;
795     getEntitySAXFunc getEntity;
796     entityDeclSAXFunc entityDecl;
797     notationDeclSAXFunc notationDecl;
798     attributeDeclSAXFunc attributeDecl;
799     elementDeclSAXFunc elementDecl;
800     unparsedEntityDeclSAXFunc unparsedEntityDecl;
801     setDocumentLocatorSAXFunc setDocumentLocator;
802     startDocumentSAXFunc startDocument;
803     endDocumentSAXFunc endDocument;
804     startElementSAXFunc startElement;
805     endElementSAXFunc endElement;
806     referenceSAXFunc reference;
807     charactersSAXFunc characters;
808     ignorableWhitespaceSAXFunc ignorableWhitespace;
809     processingInstructionSAXFunc processingInstruction;
810     commentSAXFunc comment;
811     warningSAXFunc warning;
812     errorSAXFunc error;
813     fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
814     getParameterEntitySAXFunc getParameterEntity;
815     cdataBlockSAXFunc cdataBlock;
816     externalSubsetSAXFunc externalSubset;
817     unsigned int initialized;
818 };
819 
820 
821 /**
822  * xmlExternalEntityLoader:
823  * @URL: The System ID of the resource requested
824  * @ID: The Public ID of the resource requested
825  * @context: the XML parser context
826  *
827  * External entity loaders types.
828  *
829  * Returns the entity input parser.
830  */
831 typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
832 					 const char *ID,
833 					 xmlParserCtxtPtr context);
834 
835 #ifdef __cplusplus
836 }
837 #endif
838 
839 #include <libxml/encoding.h>
840 #include <libxml/xmlIO.h>
841 #include <libxml/globals.h>
842 
843 #ifdef __cplusplus
844 extern "C" {
845 #endif
846 
847 
848 /*
849  * Init/Cleanup
850  */
851 XMLPUBFUN void XMLCALL
852 		xmlInitParser		(void);
853 XMLPUBFUN void XMLCALL
854 		xmlCleanupParser	(void);
855 
856 /*
857  * Input functions
858  */
859 XMLPUBFUN int XMLCALL
860 		xmlParserInputRead	(xmlParserInputPtr in,
861 					 int len);
862 XMLPUBFUN int XMLCALL
863 		xmlParserInputGrow	(xmlParserInputPtr in,
864 					 int len);
865 
866 /*
867  * Basic parsing Interfaces
868  */
869 #ifdef LIBXML_SAX1_ENABLED
870 XMLPUBFUN xmlDocPtr XMLCALL
871 		xmlParseDoc		(const xmlChar *cur);
872 XMLPUBFUN xmlDocPtr XMLCALL
873 		xmlParseFile		(const char *filename);
874 XMLPUBFUN xmlDocPtr XMLCALL
875 		xmlParseMemory		(const char *buffer,
876 					 int size);
877 #endif /* LIBXML_SAX1_ENABLED */
878 XMLPUBFUN int XMLCALL
879 		xmlSubstituteEntitiesDefault(int val);
880 XMLPUBFUN int XMLCALL
881 		xmlKeepBlanksDefault	(int val);
882 XMLPUBFUN void XMLCALL
883 		xmlStopParser		(xmlParserCtxtPtr ctxt);
884 XMLPUBFUN int XMLCALL
885 		xmlPedanticParserDefault(int val);
886 XMLPUBFUN int XMLCALL
887 		xmlLineNumbersDefault	(int val);
888 
889 #ifdef LIBXML_SAX1_ENABLED
890 /*
891  * Recovery mode
892  */
893 XMLPUBFUN xmlDocPtr XMLCALL
894 		xmlRecoverDoc		(const xmlChar *cur);
895 XMLPUBFUN xmlDocPtr XMLCALL
896 		xmlRecoverMemory	(const char *buffer,
897 					 int size);
898 XMLPUBFUN xmlDocPtr XMLCALL
899 		xmlRecoverFile		(const char *filename);
900 #endif /* LIBXML_SAX1_ENABLED */
901 
902 /*
903  * Less common routines and SAX interfaces
904  */
905 XMLPUBFUN int XMLCALL
906 		xmlParseDocument	(xmlParserCtxtPtr ctxt);
907 XMLPUBFUN int XMLCALL
908 		xmlParseExtParsedEnt	(xmlParserCtxtPtr ctxt);
909 #ifdef LIBXML_SAX1_ENABLED
910 XMLPUBFUN int XMLCALL
911 		xmlSAXUserParseFile	(xmlSAXHandlerPtr sax,
912 					 void *user_data,
913 					 const char *filename);
914 XMLPUBFUN int XMLCALL
915 		xmlSAXUserParseMemory	(xmlSAXHandlerPtr sax,
916 					 void *user_data,
917 					 const char *buffer,
918 					 int size);
919 XMLPUBFUN xmlDocPtr XMLCALL
920 		xmlSAXParseDoc		(xmlSAXHandlerPtr sax,
921 					 const xmlChar *cur,
922 					 int recovery);
923 XMLPUBFUN xmlDocPtr XMLCALL
924 		xmlSAXParseMemory	(xmlSAXHandlerPtr sax,
925 					 const char *buffer,
926 					 int size,
927 					 int recovery);
928 XMLPUBFUN xmlDocPtr XMLCALL
929 		xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
930 					 const char *buffer,
931 					 int size,
932 					 int recovery,
933 					 void *data);
934 XMLPUBFUN xmlDocPtr XMLCALL
935 		xmlSAXParseFile		(xmlSAXHandlerPtr sax,
936 					 const char *filename,
937 					 int recovery);
938 XMLPUBFUN xmlDocPtr XMLCALL
939 		xmlSAXParseFileWithData	(xmlSAXHandlerPtr sax,
940 					 const char *filename,
941 					 int recovery,
942 					 void *data);
943 XMLPUBFUN xmlDocPtr XMLCALL
944 		xmlSAXParseEntity	(xmlSAXHandlerPtr sax,
945 					 const char *filename);
946 XMLPUBFUN xmlDocPtr XMLCALL
947 		xmlParseEntity		(const char *filename);
948 #endif /* LIBXML_SAX1_ENABLED */
949 
950 #ifdef LIBXML_VALID_ENABLED
951 XMLPUBFUN xmlDtdPtr XMLCALL
952 		xmlSAXParseDTD		(xmlSAXHandlerPtr sax,
953 					 const xmlChar *ExternalID,
954 					 const xmlChar *SystemID);
955 XMLPUBFUN xmlDtdPtr XMLCALL
956 		xmlParseDTD		(const xmlChar *ExternalID,
957 					 const xmlChar *SystemID);
958 XMLPUBFUN xmlDtdPtr XMLCALL
959 		xmlIOParseDTD		(xmlSAXHandlerPtr sax,
960 					 xmlParserInputBufferPtr input,
961 					 xmlCharEncoding enc);
962 #endif /* LIBXML_VALID_ENABLE */
963 #ifdef LIBXML_SAX1_ENABLED
964 XMLPUBFUN int XMLCALL
965 		xmlParseBalancedChunkMemory(xmlDocPtr doc,
966 					 xmlSAXHandlerPtr sax,
967 					 void *user_data,
968 					 int depth,
969 					 const xmlChar *string,
970 					 xmlNodePtr *lst);
971 #endif /* LIBXML_SAX1_ENABLED */
972 XMLPUBFUN xmlParserErrors XMLCALL
973 		xmlParseInNodeContext	(xmlNodePtr node,
974 					 const char *data,
975 					 int datalen,
976 					 int options,
977 					 xmlNodePtr *lst);
978 #ifdef LIBXML_SAX1_ENABLED
979 XMLPUBFUN int XMLCALL
980 		xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
981                      xmlSAXHandlerPtr sax,
982                      void *user_data,
983                      int depth,
984                      const xmlChar *string,
985                      xmlNodePtr *lst,
986                      int recover);
987 XMLPUBFUN int XMLCALL
988 		xmlParseExternalEntity	(xmlDocPtr doc,
989 					 xmlSAXHandlerPtr sax,
990 					 void *user_data,
991 					 int depth,
992 					 const xmlChar *URL,
993 					 const xmlChar *ID,
994 					 xmlNodePtr *lst);
995 #endif /* LIBXML_SAX1_ENABLED */
996 XMLPUBFUN int XMLCALL
997 		xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
998 					 const xmlChar *URL,
999 					 const xmlChar *ID,
1000 					 xmlNodePtr *lst);
1001 
1002 /*
1003  * Parser contexts handling.
1004  */
1005 XMLPUBFUN xmlParserCtxtPtr XMLCALL
1006 		xmlNewParserCtxt	(void);
1007 XMLPUBFUN int XMLCALL
1008 		xmlInitParserCtxt	(xmlParserCtxtPtr ctxt);
1009 XMLPUBFUN void XMLCALL
1010 		xmlClearParserCtxt	(xmlParserCtxtPtr ctxt);
1011 XMLPUBFUN void XMLCALL
1012 		xmlFreeParserCtxt	(xmlParserCtxtPtr ctxt);
1013 #ifdef LIBXML_SAX1_ENABLED
1014 XMLPUBFUN void XMLCALL
1015 		xmlSetupParserForBuffer	(xmlParserCtxtPtr ctxt,
1016 					 const xmlChar* buffer,
1017 					 const char *filename);
1018 #endif /* LIBXML_SAX1_ENABLED */
1019 XMLPUBFUN xmlParserCtxtPtr XMLCALL
1020 		xmlCreateDocParserCtxt	(const xmlChar *cur);
1021 
1022 #ifdef LIBXML_LEGACY_ENABLED
1023 /*
1024  * Reading/setting optional parsing features.
1025  */
1026 XMLPUBFUN int XMLCALL
1027 		xmlGetFeaturesList	(int *len,
1028 					 const char **result);
1029 XMLPUBFUN int XMLCALL
1030 		xmlGetFeature		(xmlParserCtxtPtr ctxt,
1031 					 const char *name,
1032 					 void *result);
1033 XMLPUBFUN int XMLCALL
1034 		xmlSetFeature		(xmlParserCtxtPtr ctxt,
1035 					 const char *name,
1036 					 void *value);
1037 #endif /* LIBXML_LEGACY_ENABLED */
1038 
1039 #ifdef LIBXML_PUSH_ENABLED
1040 /*
1041  * Interfaces for the Push mode.
1042  */
1043 XMLPUBFUN xmlParserCtxtPtr XMLCALL
1044 		xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
1045 					 void *user_data,
1046 					 const char *chunk,
1047 					 int size,
1048 					 const char *filename);
1049 XMLPUBFUN int XMLCALL
1050 		xmlParseChunk		(xmlParserCtxtPtr ctxt,
1051 					 const char *chunk,
1052 					 int size,
1053 					 int terminate);
1054 #endif /* LIBXML_PUSH_ENABLED */
1055 
1056 /*
1057  * Special I/O mode.
1058  */
1059 
1060 XMLPUBFUN xmlParserCtxtPtr XMLCALL
1061 		xmlCreateIOParserCtxt	(xmlSAXHandlerPtr sax,
1062 					 void *user_data,
1063 					 xmlInputReadCallback   ioread,
1064 					 xmlInputCloseCallback  ioclose,
1065 					 void *ioctx,
1066 					 xmlCharEncoding enc);
1067 
1068 XMLPUBFUN xmlParserInputPtr XMLCALL
1069 		xmlNewIOInputStream	(xmlParserCtxtPtr ctxt,
1070 					 xmlParserInputBufferPtr input,
1071 					 xmlCharEncoding enc);
1072 
1073 /*
1074  * Node infos.
1075  */
1076 XMLPUBFUN const xmlParserNodeInfo* XMLCALL
1077 		xmlParserFindNodeInfo	(const xmlParserCtxtPtr ctxt,
1078 				         const xmlNodePtr node);
1079 XMLPUBFUN void XMLCALL
1080 		xmlInitNodeInfoSeq	(xmlParserNodeInfoSeqPtr seq);
1081 XMLPUBFUN void XMLCALL
1082 		xmlClearNodeInfoSeq	(xmlParserNodeInfoSeqPtr seq);
1083 XMLPUBFUN unsigned long XMLCALL
1084 		xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
1085                                          const xmlNodePtr node);
1086 XMLPUBFUN void XMLCALL
1087 		xmlParserAddNodeInfo	(xmlParserCtxtPtr ctxt,
1088 					 const xmlParserNodeInfoPtr info);
1089 
1090 /*
1091  * External entities handling actually implemented in xmlIO.
1092  */
1093 
1094 XMLPUBFUN void XMLCALL
1095 		xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1096 XMLPUBFUN xmlExternalEntityLoader XMLCALL
1097 		xmlGetExternalEntityLoader(void);
1098 XMLPUBFUN xmlParserInputPtr XMLCALL
1099 		xmlLoadExternalEntity	(const char *URL,
1100 					 const char *ID,
1101 					 xmlParserCtxtPtr ctxt);
1102 
1103 /*
1104  * Index lookup, actually implemented in the encoding module
1105  */
1106 XMLPUBFUN long XMLCALL
1107 		xmlByteConsumed		(xmlParserCtxtPtr ctxt);
1108 
1109 /*
1110  * New set of simpler/more flexible APIs
1111  */
1112 /**
1113  * xmlParserOption:
1114  *
1115  * This is the set of XML parser options that can be passed down
1116  * to the xmlReadDoc() and similar calls.
1117  */
1118 typedef enum {
1119     XML_PARSE_RECOVER	= 1<<0,	/* recover on errors */
1120     XML_PARSE_NOENT	= 1<<1,	/* substitute entities */
1121     XML_PARSE_DTDLOAD	= 1<<2,	/* load the external subset */
1122     XML_PARSE_DTDATTR	= 1<<3,	/* default DTD attributes */
1123     XML_PARSE_DTDVALID	= 1<<4,	/* validate with the DTD */
1124     XML_PARSE_NOERROR	= 1<<5,	/* suppress error reports */
1125     XML_PARSE_NOWARNING	= 1<<6,	/* suppress warning reports */
1126     XML_PARSE_PEDANTIC	= 1<<7,	/* pedantic error reporting */
1127     XML_PARSE_NOBLANKS	= 1<<8,	/* remove blank nodes */
1128     XML_PARSE_SAX1	= 1<<9,	/* use the SAX1 interface internally */
1129     XML_PARSE_XINCLUDE	= 1<<10,/* Implement XInclude substitition  */
1130     XML_PARSE_NONET	= 1<<11,/* Forbid network access */
1131     XML_PARSE_NODICT	= 1<<12,/* Do not reuse the context dictionary */
1132     XML_PARSE_NSCLEAN	= 1<<13,/* remove redundant namespaces declarations */
1133     XML_PARSE_NOCDATA	= 1<<14,/* merge CDATA as text nodes */
1134     XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
1135     XML_PARSE_COMPACT   = 1<<16,/* compact small text nodes; no modification of
1136                                    the tree allowed afterwards (will possibly
1137 				   crash if you try to modify the tree) */
1138     XML_PARSE_OLD10	= 1<<17,/* parse using XML-1.0 before update 5 */
1139     XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
1140     XML_PARSE_HUGE      = 1<<19,/* relax any hardcoded limit from the parser */
1141     XML_PARSE_OLDSAX    = 1<<20,/* parse using SAX2 interface before 2.7.0 */
1142     XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
1143     XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
1144 } xmlParserOption;
1145 
1146 XMLPUBFUN void XMLCALL
1147 		xmlCtxtReset		(xmlParserCtxtPtr ctxt);
1148 XMLPUBFUN int XMLCALL
1149 		xmlCtxtResetPush	(xmlParserCtxtPtr ctxt,
1150 					 const char *chunk,
1151 					 int size,
1152 					 const char *filename,
1153 					 const char *encoding);
1154 XMLPUBFUN int XMLCALL
1155 		xmlCtxtUseOptions	(xmlParserCtxtPtr ctxt,
1156 					 int options);
1157 XMLPUBFUN xmlDocPtr XMLCALL
1158 		xmlReadDoc		(const xmlChar *cur,
1159 					 const char *URL,
1160 					 const char *encoding,
1161 					 int options);
1162 XMLPUBFUN xmlDocPtr XMLCALL
1163 		xmlReadFile		(const char *URL,
1164 					 const char *encoding,
1165 					 int options);
1166 XMLPUBFUN xmlDocPtr XMLCALL
1167 		xmlReadMemory		(const char *buffer,
1168 					 int size,
1169 					 const char *URL,
1170 					 const char *encoding,
1171 					 int options);
1172 XMLPUBFUN xmlDocPtr XMLCALL
1173 		xmlReadFd		(int fd,
1174 					 const char *URL,
1175 					 const char *encoding,
1176 					 int options);
1177 XMLPUBFUN xmlDocPtr XMLCALL
1178 		xmlReadIO		(xmlInputReadCallback ioread,
1179 					 xmlInputCloseCallback ioclose,
1180 					 void *ioctx,
1181 					 const char *URL,
1182 					 const char *encoding,
1183 					 int options);
1184 XMLPUBFUN xmlDocPtr XMLCALL
1185 		xmlCtxtReadDoc		(xmlParserCtxtPtr ctxt,
1186 					 const xmlChar *cur,
1187 					 const char *URL,
1188 					 const char *encoding,
1189 					 int options);
1190 XMLPUBFUN xmlDocPtr XMLCALL
1191 		xmlCtxtReadFile		(xmlParserCtxtPtr ctxt,
1192 					 const char *filename,
1193 					 const char *encoding,
1194 					 int options);
1195 XMLPUBFUN xmlDocPtr XMLCALL
1196 		xmlCtxtReadMemory		(xmlParserCtxtPtr ctxt,
1197 					 const char *buffer,
1198 					 int size,
1199 					 const char *URL,
1200 					 const char *encoding,
1201 					 int options);
1202 XMLPUBFUN xmlDocPtr XMLCALL
1203 		xmlCtxtReadFd		(xmlParserCtxtPtr ctxt,
1204 					 int fd,
1205 					 const char *URL,
1206 					 const char *encoding,
1207 					 int options);
1208 XMLPUBFUN xmlDocPtr XMLCALL
1209 		xmlCtxtReadIO		(xmlParserCtxtPtr ctxt,
1210 					 xmlInputReadCallback ioread,
1211 					 xmlInputCloseCallback ioclose,
1212 					 void *ioctx,
1213 					 const char *URL,
1214 					 const char *encoding,
1215 					 int options);
1216 
1217 /*
1218  * Library wide options
1219  */
1220 /**
1221  * xmlFeature:
1222  *
1223  * Used to examine the existance of features that can be enabled
1224  * or disabled at compile-time.
1225  * They used to be called XML_FEATURE_xxx but this clashed with Expat
1226  */
1227 typedef enum {
1228     XML_WITH_THREAD = 1,
1229     XML_WITH_TREE = 2,
1230     XML_WITH_OUTPUT = 3,
1231     XML_WITH_PUSH = 4,
1232     XML_WITH_READER = 5,
1233     XML_WITH_PATTERN = 6,
1234     XML_WITH_WRITER = 7,
1235     XML_WITH_SAX1 = 8,
1236     XML_WITH_FTP = 9,
1237     XML_WITH_HTTP = 10,
1238     XML_WITH_VALID = 11,
1239     XML_WITH_HTML = 12,
1240     XML_WITH_LEGACY = 13,
1241     XML_WITH_C14N = 14,
1242     XML_WITH_CATALOG = 15,
1243     XML_WITH_XPATH = 16,
1244     XML_WITH_XPTR = 17,
1245     XML_WITH_XINCLUDE = 18,
1246     XML_WITH_ICONV = 19,
1247     XML_WITH_ISO8859X = 20,
1248     XML_WITH_UNICODE = 21,
1249     XML_WITH_REGEXP = 22,
1250     XML_WITH_AUTOMATA = 23,
1251     XML_WITH_EXPR = 24,
1252     XML_WITH_SCHEMAS = 25,
1253     XML_WITH_SCHEMATRON = 26,
1254     XML_WITH_MODULES = 27,
1255     XML_WITH_DEBUG = 28,
1256     XML_WITH_DEBUG_MEM = 29,
1257     XML_WITH_DEBUG_RUN = 30,
1258     XML_WITH_ZLIB = 31,
1259     XML_WITH_ICU = 32,
1260     XML_WITH_LZMA = 33,
1261     XML_WITH_NONE = 99999 /* just to be sure of allocation size */
1262 } xmlFeature;
1263 
1264 XMLPUBFUN int XMLCALL
1265 		xmlHasFeature		(xmlFeature feature);
1266 
1267 #ifdef __cplusplus
1268 }
1269 #endif
1270 #endif /* __XML_PARSER_H__ */
1271