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