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