VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/include/libxml/parser.h@ 107935

Last change on this file since 107935 was 105420, checked in by vboxsync, 7 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette