1/**
2 * @file
3 *
4 * @brief Validating XML 1.0 parser
5 *
6 * Interfaces, constants and types related to the XML parser.
7 *
8 * @copyright See Copyright for the status of this software.
9 *
10 * @author Daniel Veillard
11 */
12
13#ifndef __XML_PARSER_H__
14#define __XML_PARSER_H__
15
16#include <libxml/xmlversion.h>
17/** @cond ignore */
18#define XML_TREE_INTERNALS
19/** @endcond */
20#include <libxml/tree.h>
21#undef XML_TREE_INTERNALS
22#include <libxml/dict.h>
23#include <libxml/hash.h>
24#include <libxml/valid.h>
25#include <libxml/entities.h>
26#include <libxml/xmlerror.h>
27#include <libxml/xmlstring.h>
28#include <libxml/xmlmemory.h>
29#include <libxml/encoding.h>
30#include <libxml/xmlIO.h>
31/* for compatibility */
32#include <libxml/SAX2.h>
33#include <libxml/threads.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 * The default version of XML used: 1.0
41 */
42#define XML_DEFAULT_VERSION "1.0"
43
44/**
45 * Status after parsing a document
46 */
47typedef enum {
48 /** not well-formed */
49 XML_STATUS_NOT_WELL_FORMED = (1 << 0),
50 /** not namespace-well-formed */
51 XML_STATUS_NOT_NS_WELL_FORMED = (1 << 1),
52 /** DTD validation failed */
53 XML_STATUS_DTD_VALIDATION_FAILED = (1 << 2),
54 /** catastrophic failure like OOM or I/O error */
55 XML_STATUS_CATASTROPHIC_ERROR = (1 << 3)
56} xmlParserStatus;
57
58/**
59 * Resource type for resource loaders
60 */
61typedef enum {
62 /** unknown */
63 XML_RESOURCE_UNKNOWN = 0,
64 /** main document */
65 XML_RESOURCE_MAIN_DOCUMENT,
66 /** external DTD */
67 XML_RESOURCE_DTD,
68 /** external general entity */
69 XML_RESOURCE_GENERAL_ENTITY,
70 /** external parameter entity */
71 XML_RESOURCE_PARAMETER_ENTITY,
72 /** XIncluded document */
73 XML_RESOURCE_XINCLUDE,
74 /** XIncluded text */
75 XML_RESOURCE_XINCLUDE_TEXT
76} xmlResourceType;
77
78/**
79 * Flags for parser input
80 */
81typedef enum {
82 /** The input buffer won't be changed during parsing. */
83 XML_INPUT_BUF_STATIC = (1 << 1),
84 /** The input buffer is zero-terminated. (Note that the zero
85 byte shouldn't be included in buffer size.) */
86 XML_INPUT_BUF_ZERO_TERMINATED = (1 << 2),
87 /** Uncompress gzipped file input */
88 XML_INPUT_UNZIP = (1 << 3),
89 /** Allow network access. Unused internally. */
90 XML_INPUT_NETWORK = (1 << 4),
91 /** Allow system catalog to resolve URIs. */
92 XML_INPUT_USE_SYS_CATALOG = (1 << 5)
93} xmlParserInputFlags;
94
95/* Deprecated */
96typedef void (* xmlParserInputDeallocate)(xmlChar *str);
97
98/**
99 * Parser input
100 */
101struct _xmlParserInput {
102 /* Input buffer */
103 xmlParserInputBuffer *buf XML_DEPRECATED_MEMBER;
104 /**
105 * @deprecated Use #xmlCtxtGetInputPosition
106 *
107 * The filename or URI, if any
108 */
109 const char *filename;
110 /* unused */
111 const char *directory XML_DEPRECATED_MEMBER;
112 /* Base of the array to parse */
113 const xmlChar *base;
114 /**
115 * @deprecated Use #xmlCtxtGetInputWindow
116 *
117 * Current char being parsed
118 */
119 const xmlChar *cur;
120 /* end of the array to parse */
121 const xmlChar *end;
122 /* unused */
123 int length XML_DEPRECATED_MEMBER;
124 /**
125 * @deprecated Use #xmlCtxtGetInputPosition
126 *
127 * Current line
128 */
129 int line;
130 /**
131 * @deprecated Use #xmlCtxtGetInputPosition
132 *
133 * Current column
134 */
135 int col;
136 /**
137 * @deprecated Use #xmlCtxtGetInputPosition
138 *
139 * How many xmlChars already consumed
140 */
141 unsigned long consumed;
142 /* function to deallocate the base */
143 xmlParserInputDeallocate free XML_DEPRECATED_MEMBER;
144 /* unused */
145 const xmlChar *encoding XML_DEPRECATED_MEMBER;
146 /* the version string for entity */
147 const xmlChar *version XML_DEPRECATED_MEMBER;
148 /* Flags */
149 int flags XML_DEPRECATED_MEMBER;
150 /* an unique identifier for the entity, unused internally */
151 int id XML_DEPRECATED_MEMBER;
152 /* unused */
153 unsigned long parentConsumed XML_DEPRECATED_MEMBER;
154 /* entity, if any */
155 xmlEntity *entity XML_DEPRECATED_MEMBER;
156};
157
158/** @cond ignore */
159
160typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
161typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
162
163struct _xmlParserNodeInfo {
164 const struct _xmlNode* node;
165 /* Position & line # that text that created the node begins & ends on */
166 unsigned long begin_pos;
167 unsigned long begin_line;
168 unsigned long end_pos;
169 unsigned long end_line;
170};
171
172typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
173typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
174struct _xmlParserNodeInfoSeq {
175 unsigned long maximum;
176 unsigned long length;
177 xmlParserNodeInfo* buffer;
178};
179
180/*
181 * Internal type
182 */
183typedef enum {
184 XML_PARSER_EOF = -1, /* nothing is to be parsed */
185 XML_PARSER_START = 0, /* nothing has been parsed */
186 XML_PARSER_MISC, /* Misc* before int subset */
187 XML_PARSER_PI, /* Within a processing instruction */
188 XML_PARSER_DTD, /* within some DTD content */
189 XML_PARSER_PROLOG, /* Misc* after internal subset */
190 XML_PARSER_COMMENT, /* within a comment */
191 XML_PARSER_START_TAG, /* within a start tag */
192 XML_PARSER_CONTENT, /* within the content */
193 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
194 XML_PARSER_END_TAG, /* within a closing tag */
195 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
196 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
197 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
198 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
199 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
200 XML_PARSER_IGNORE, /* within an IGNORED section */
201 XML_PARSER_PUBLIC_LITERAL, /* within a PUBLIC value */
202 XML_PARSER_XML_DECL /* before XML decl (but after BOM) */
203} xmlParserInputState;
204
205/*
206 * Internal bits in the 'loadsubset' context member
207 */
208#define XML_DETECT_IDS 2
209#define XML_COMPLETE_ATTRS 4
210#define XML_SKIP_IDS 8
211
212/*
213 * Internal type. Only XML_PARSE_READER is used.
214 */
215typedef enum {
216 XML_PARSE_UNKNOWN = 0,
217 XML_PARSE_DOM = 1,
218 XML_PARSE_SAX = 2,
219 XML_PARSE_PUSH_DOM = 3,
220 XML_PARSE_PUSH_SAX = 4,
221 XML_PARSE_READER = 5
222} xmlParserMode;
223
224typedef struct _xmlStartTag xmlStartTag;
225typedef struct _xmlParserNsData xmlParserNsData;
226typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
227
228/** @endcond */
229
230/**
231 * Callback for custom resource loaders.
232 *
233 * `flags` can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK.
234 *
235 * The URL is resolved using XML catalogs before being passed to
236 * the callback.
237 *
238 * On success, `out` should be set to a new parser input object and
239 * XML_ERR_OK should be returned.
240 *
241 * @param ctxt parser context
242 * @param url URL or system ID to load
243 * @param publicId publid ID from DTD (optional)
244 * @param type resource type
245 * @param flags flags
246 * @param out result pointer
247 * @returns an xmlParserErrors code.
248 */
249typedef xmlParserErrors
250(*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
251 xmlResourceType type, xmlParserInputFlags flags,
252 xmlParserInput **out);
253
254/**
255 * Parser context
256 */
257struct _xmlParserCtxt {
258 /**
259 * @deprecated Use xmlCtxtGetSaxHandler() and
260 * xmlCtxtSetSaxHandler().
261 *
262 * the SAX handler
263 */
264 struct _xmlSAXHandler *sax;
265 /**
266 * @deprecated Use #xmlCtxtGetUserData
267 *
268 * user data for SAX interface, defaults to the context itself
269 */
270 void *userData;
271 /**
272 * @deprecated Use xmlCtxtGetDocument()
273 *
274 * the document being built
275 */
276 xmlDoc *myDoc;
277 /**
278 * @deprecated Use xmlCtxtGetStatus()
279 *
280 * is the document well formed?
281 */
282 int wellFormed;
283 /**
284 * @deprecated Use xmlParserOption XML_PARSE_NOENT
285 *
286 * shall we replace entities?
287 */
288 int replaceEntities XML_DEPRECATED_MEMBER;
289 /**
290 * @deprecated Use xmlCtxtGetVersion()
291 *
292 * the XML version string
293 */
294 xmlChar *version;
295 /**
296 * @deprecated Use xmlCtxtGetDeclaredEncoding()
297 *
298 * the declared encoding, if any
299 */
300 xmlChar *encoding;
301 /**
302 * @deprecated Use xmlCtxtGetStandalone()
303 *
304 * standalone document
305 */
306 int standalone;
307
308 /**
309 * @deprecated Use xmlCtxtIsHtml()
310 *
311 * non-zero for HTML documents, actually an htmlInsertMode
312 */
313 int html;
314
315 /* Input stream stack */
316
317 /**
318 * Current input stream
319 */
320 /* TODO: Add accessors, see issue #762 */
321 xmlParserInput *input;
322 /* Number of current input streams */
323 int inputNr;
324 /* Max number of input streams */
325 int inputMax XML_DEPRECATED_MEMBER;
326 /* stack of inputs */
327 xmlParserInput **inputTab;
328
329 /* Node analysis stack only used for DOM building */
330
331 /**
332 * @deprecated Use #xmlCtxtGetNode
333 *
334 * The current element.
335 */
336 xmlNode *node;
337 /* Depth of the parsing stack */
338 int nodeNr XML_DEPRECATED_MEMBER;
339 /* Max depth of the parsing stack */
340 int nodeMax XML_DEPRECATED_MEMBER;
341 /* array of nodes */
342 xmlNode **nodeTab XML_DEPRECATED_MEMBER;
343
344 /* Whether node info should be kept */
345 int record_info;
346 /* info about each node parsed */
347 xmlParserNodeInfoSeq node_seq XML_DEPRECATED_MEMBER;
348
349 /**
350 * @deprecated Use xmlCtxtGetLastError()
351 *
352 * error code
353 */
354 int errNo;
355
356 /* reference and external subset */
357 int hasExternalSubset XML_DEPRECATED_MEMBER;
358 /* the internal subset has PE refs */
359 int hasPErefs XML_DEPRECATED_MEMBER;
360 /* unused */
361 int external XML_DEPRECATED_MEMBER;
362
363 /**
364 * @deprecated Use xmlCtxtGetStatus()
365 *
366 * is the document valid
367 */
368 int valid;
369 /**
370 * @deprecated Use xmlParserOption XML_PARSE_DTDVALID
371 *
372 * shall we try to validate?
373 */
374 int validate XML_DEPRECATED_MEMBER;
375 /**
376 * @deprecated Use xmlCtxtGetValidCtxt()
377 *
378 * The validity context
379 */
380 xmlValidCtxt vctxt;
381
382 /* push parser state */
383 xmlParserInputState instate XML_DEPRECATED_MEMBER;
384 /* unused */
385 int token XML_DEPRECATED_MEMBER;
386
387 /**
388 * @deprecated Don't use
389 *
390 * The main document URI, if available, with its last
391 * component stripped.
392 */
393 char *directory;
394
395 /* Node name stack */
396
397 /* Current parsed Node */
398 const xmlChar *name XML_DEPRECATED_MEMBER;
399 /* Depth of the parsing stack */
400 int nameNr XML_DEPRECATED_MEMBER;
401 /* Max depth of the parsing stack */
402 int nameMax XML_DEPRECATED_MEMBER;
403 /* array of nodes */
404 const xmlChar **nameTab XML_DEPRECATED_MEMBER;
405
406 /* unused */
407 long nbChars XML_DEPRECATED_MEMBER;
408 /* used by progressive parsing lookup */
409 long checkIndex XML_DEPRECATED_MEMBER;
410 /**
411 * @deprecated Use inverted xmlParserOption XML_PARSE_NOBLANKS
412 *
413 * ugly but ...
414 */
415 int keepBlanks XML_DEPRECATED_MEMBER;
416 /**
417 * @deprecated Use xmlCtxtIsStopped()
418 *
419 * SAX callbacks are disabled
420 */
421 int disableSAX XML_DEPRECATED_MEMBER;
422 /**
423 * @deprecated Use xmlCtxtIsInSubset
424 *
425 * Set if DTD content is parsed.
426 *
427 * - 0: not in DTD
428 * - 1: in internal DTD subset
429 * - 2: in external DTD subset
430 */
431 int inSubset;
432 /**
433 * @deprecated Use the `name` argument of the
434 * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
435 *
436 * Name of the internal subset (root element type).
437 */
438 const xmlChar *intSubName;
439 /**
440 * @deprecated Use the `systemId` argument of the
441 * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
442 *
443 * System identifier (URI) of external the subset.
444 */
445 xmlChar *extSubURI;
446 /**
447 * @deprecated Use the `publicId` argument of the
448 * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
449 *
450 * This member is MISNAMED. It contains the *public* identifier
451 * of the external subset.
452 */
453 xmlChar *extSubSystem;
454
455 /* xml:space values */
456
457 /* Should the parser preserve spaces */
458 int *space XML_DEPRECATED_MEMBER;
459 /* Depth of the parsing stack */
460 int spaceNr XML_DEPRECATED_MEMBER;
461 /* Max depth of the parsing stack */
462 int spaceMax XML_DEPRECATED_MEMBER;
463 /* array of space infos */
464 int *spaceTab XML_DEPRECATED_MEMBER;
465
466 /* to prevent entity substitution loops */
467 int depth XML_DEPRECATED_MEMBER;
468 /* unused */
469 xmlParserInput *entity XML_DEPRECATED_MEMBER;
470 /* unused */
471 int charset XML_DEPRECATED_MEMBER;
472 /* Those two fields are there to speed up large node parsing */
473 int nodelen XML_DEPRECATED_MEMBER;
474 int nodemem XML_DEPRECATED_MEMBER;
475 /**
476 * @deprecated Use xmlParserOption XML_PARSE_PEDANTIC
477 *
478 * signal pedantic warnings
479 */
480 int pedantic XML_DEPRECATED_MEMBER;
481 /**
482 * @deprecated Use xmlCtxtGetPrivate() and xmlCtxtSetPrivate()
483 *
484 * For user data, libxml won't touch it
485 */
486 void *_private;
487 /**
488 * @deprecated Use xmlParserOption XML_PARSE_DTDLOAD,
489 * XML_PARSE_DTDATTR or XML_PARSE_SKIP_IDS.
490 *
491 * Control loading of the external subset and handling of IDs.
492 * Other options like `validate` can override this value.
493 *
494 * - 0: The default behavior is to process IDs and to ignore
495 * the external subset.
496 * - XML_DETECT_IDS: Load external subset. This flag is
497 * misnamed. ID handling is only controlled by XML_SKIP_IDS.
498 * - XML_COMPLETE_ATTRS: Load external subset and process
499 * default attributes.
500 * - XML_SKIP_IDS: Ignore IDs.
501 */
502 int loadsubset XML_DEPRECATED_MEMBER;
503 /* unused */
504 int linenumbers XML_DEPRECATED_MEMBER;
505 /**
506 * @deprecated Use xmlCtxtGetCatalogs() and xmlCtxtSetCatalogs()
507 *
508 * document's own catalog
509 */
510 void *catalogs XML_DEPRECATED_MEMBER;
511 /**
512 * @deprecated Use xmlParserOption XML_PARSE_RECOVER
513 * run in recovery mode
514 */
515 int recovery XML_DEPRECATED_MEMBER;
516 /* unused */
517 int progressive XML_DEPRECATED_MEMBER;
518 /**
519 * @deprecated Use xmlCtxtGetDict() and xmlCtxtSetDict()
520 *
521 * dictionary for the parser
522 */
523 xmlDict *dict;
524 /* array for the attributes callbacks */
525 const xmlChar **atts XML_DEPRECATED_MEMBER;
526 /* the size of the array */
527 int maxatts XML_DEPRECATED_MEMBER;
528 /* unused */
529 int docdict XML_DEPRECATED_MEMBER;
530
531 /*
532 * pre-interned strings
533 */
534 const xmlChar *str_xml XML_DEPRECATED_MEMBER;
535 const xmlChar *str_xmlns XML_DEPRECATED_MEMBER;
536 const xmlChar *str_xml_ns XML_DEPRECATED_MEMBER;
537
538 /*
539 * Everything below is used only by the new SAX mode
540 */
541
542 /* operating in the new SAX mode */
543 int sax2 XML_DEPRECATED_MEMBER;
544 /* the number of inherited namespaces */
545 int nsNr XML_DEPRECATED_MEMBER;
546 /* the size of the arrays */
547 int nsMax XML_DEPRECATED_MEMBER;
548 /* the array of prefix/namespace name */
549 const xmlChar **nsTab XML_DEPRECATED_MEMBER;
550 /* which attribute were allocated */
551 unsigned *attallocs XML_DEPRECATED_MEMBER;
552 /* array of data for push */
553 xmlStartTag *pushTab XML_DEPRECATED_MEMBER;
554 /* defaulted attributes if any */
555 xmlHashTable *attsDefault XML_DEPRECATED_MEMBER;
556 /* non-CDATA attributes if any */
557 xmlHashTable *attsSpecial XML_DEPRECATED_MEMBER;
558
559 /**
560 * @deprecated Use xmlCtxtGetStatus()
561 *
562 * is the document XML Namespace okay
563 */
564 int nsWellFormed;
565 /**
566 * @deprecated Use xmlCtxtGetOptions()
567 *
568 * Extra options
569 */
570 int options;
571
572 /**
573 * @deprecated Use inverted xmlParserOption XML_PARSE_NODICT
574 *
575 * Use dictionary names for the tree
576 */
577 int dictNames XML_DEPRECATED_MEMBER;
578
579 /*
580 * Those fields are needed only for streaming parsing so far
581 */
582
583 /* number of freed element nodes */
584 int freeElemsNr XML_DEPRECATED_MEMBER;
585 /* List of freed element nodes */
586 xmlNode *freeElems XML_DEPRECATED_MEMBER;
587 /* number of freed attributes nodes */
588 int freeAttrsNr XML_DEPRECATED_MEMBER;
589 /* List of freed attributes nodes */
590 xmlAttr *freeAttrs XML_DEPRECATED_MEMBER;
591
592 /**
593 * @deprecated Use xmlCtxtGetLastError()
594 *
595 * the complete error information for the last error.
596 */
597 xmlError lastError XML_DEPRECATED_MEMBER;
598 /* the parser mode */
599 xmlParserMode parseMode XML_DEPRECATED_MEMBER;
600 /* unused */
601 unsigned long nbentities XML_DEPRECATED_MEMBER;
602 /* size of external entities */
603 unsigned long sizeentities XML_DEPRECATED_MEMBER;
604
605 /* for use by HTML non-recursive parser */
606 /* Current NodeInfo */
607 xmlParserNodeInfo *nodeInfo XML_DEPRECATED_MEMBER;
608 /* Depth of the parsing stack */
609 int nodeInfoNr XML_DEPRECATED_MEMBER;
610 /* Max depth of the parsing stack */
611 int nodeInfoMax XML_DEPRECATED_MEMBER;
612 /* array of nodeInfos */
613 xmlParserNodeInfo *nodeInfoTab XML_DEPRECATED_MEMBER;
614
615 /* we need to label inputs */
616 int input_id XML_DEPRECATED_MEMBER;
617 /* volume of entity copy */
618 unsigned long sizeentcopy XML_DEPRECATED_MEMBER;
619
620 /* quote state for push parser */
621 int endCheckState XML_DEPRECATED_MEMBER;
622 /* number of errors */
623 unsigned short nbErrors XML_DEPRECATED_MEMBER;
624 /* number of warnings */
625 unsigned short nbWarnings XML_DEPRECATED_MEMBER;
626 /* maximum amplification factor */
627 unsigned maxAmpl XML_DEPRECATED_MEMBER;
628
629 /* namespace database */
630 xmlParserNsData *nsdb XML_DEPRECATED_MEMBER;
631 /* allocated size */
632 unsigned attrHashMax XML_DEPRECATED_MEMBER;
633 /* atttribute hash table */
634 xmlAttrHashBucket *attrHash XML_DEPRECATED_MEMBER;
635
636 xmlStructuredErrorFunc errorHandler XML_DEPRECATED_MEMBER;
637 void *errorCtxt XML_DEPRECATED_MEMBER;
638
639 xmlResourceLoader resourceLoader XML_DEPRECATED_MEMBER;
640 void *resourceCtxt XML_DEPRECATED_MEMBER;
641
642 xmlCharEncConvImpl convImpl XML_DEPRECATED_MEMBER;
643 void *convCtxt XML_DEPRECATED_MEMBER;
644};
645
646/**
647 * A SAX Locator.
648 */
649struct _xmlSAXLocator {
650 const xmlChar *(*getPublicId)(void *ctx);
651 const xmlChar *(*getSystemId)(void *ctx);
652 int (*getLineNumber)(void *ctx);
653 int (*getColumnNumber)(void *ctx);
654};
655
656/**
657 * SAX callback to resolve external entities.
658 *
659 * This is only used to load DTDs. The preferred way to install
660 * custom resolvers is #xmlCtxtSetResourceLoader.
661 *
662 * @param ctx the user data (XML parser context)
663 * @param publicId The public identifier of the entity
664 * @param systemId The system identifier of the entity (URL)
665 * @returns the xmlParserInput if inlined or NULL for DOM behaviour.
666 */
667typedef xmlParserInput *(*resolveEntitySAXFunc) (void *ctx,
668 const xmlChar *publicId,
669 const xmlChar *systemId);
670/**
671 * SAX callback for the internal subset.
672 *
673 * @param ctx the user data (XML parser context)
674 * @param name the root element name
675 * @param publicId the public identifier
676 * @param systemId the system identifier (e.g. filename or URL)
677 */
678typedef void (*internalSubsetSAXFunc) (void *ctx,
679 const xmlChar *name,
680 const xmlChar *publicId,
681 const xmlChar *systemId);
682/**
683 * SAX callback for the external subset.
684 *
685 * @param ctx the user data (XML parser context)
686 * @param name the root element name
687 * @param publicId the public identifier
688 * @param systemId the system identifier (e.g. filename or URL)
689 */
690typedef void (*externalSubsetSAXFunc) (void *ctx,
691 const xmlChar *name,
692 const xmlChar *publicId,
693 const xmlChar *systemId);
694/**
695 * SAX callback to look up a general entity by name.
696 *
697 * @param ctx the user data (XML parser context)
698 * @param name The entity name
699 * @returns the xmlEntity if found.
700 */
701typedef xmlEntity *(*getEntitySAXFunc) (void *ctx,
702 const xmlChar *name);
703/**
704 * SAX callback to look up a parameter entity by name.
705 *
706 * @param ctx the user data (XML parser context)
707 * @param name The entity name
708 * @returns the xmlEntity if found.
709 */
710typedef xmlEntity *(*getParameterEntitySAXFunc) (void *ctx,
711 const xmlChar *name);
712/**
713 * SAX callback for entity declarations.
714 *
715 * @param ctx the user data (XML parser context)
716 * @param name the entity name
717 * @param type the entity type
718 * @param publicId The public ID of the entity
719 * @param systemId The system ID of the entity
720 * @param content the entity value (without processing).
721 */
722typedef void (*entityDeclSAXFunc) (void *ctx,
723 const xmlChar *name,
724 int type,
725 const xmlChar *publicId,
726 const xmlChar *systemId,
727 xmlChar *content);
728/**
729 * SAX callback for notation declarations.
730 *
731 * @param ctx the user data (XML parser context)
732 * @param name The name of the notation
733 * @param publicId The public ID of the notation
734 * @param systemId The system ID of the notation
735 */
736typedef void (*notationDeclSAXFunc)(void *ctx,
737 const xmlChar *name,
738 const xmlChar *publicId,
739 const xmlChar *systemId);
740/**
741 * SAX callback for attribute declarations.
742 *
743 * @param ctx the user data (XML parser context)
744 * @param elem the name of the element
745 * @param fullname the attribute name
746 * @param type the attribute type
747 * @param def the type of default value
748 * @param defaultValue the attribute default value
749 * @param tree the tree of enumerated value set
750 */
751typedef void (*attributeDeclSAXFunc)(void *ctx,
752 const xmlChar *elem,
753 const xmlChar *fullname,
754 int type,
755 int def,
756 const xmlChar *defaultValue,
757 xmlEnumeration *tree);
758/**
759 * SAX callback for element declarations.
760 *
761 * @param ctx the user data (XML parser context)
762 * @param name the element name
763 * @param type the element type
764 * @param content the element value tree
765 */
766typedef void (*elementDeclSAXFunc)(void *ctx,
767 const xmlChar *name,
768 int type,
769 xmlElementContent *content);
770/**
771 * SAX callback for unparsed entity declarations.
772 *
773 * @param ctx the user data (XML parser context)
774 * @param name The name of the entity
775 * @param publicId The public ID of the entity
776 * @param systemId The system ID of the entity
777 * @param notationName the name of the notation
778 */
779typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
780 const xmlChar *name,
781 const xmlChar *publicId,
782 const xmlChar *systemId,
783 const xmlChar *notationName);
784/**
785 * This callback receives the "document locator" at startup,
786 * which is always the global xmlDefaultSAXLocator.
787 *
788 * Everything is available on the context, so this is useless in
789 * our case.
790 *
791 * @param ctx the user data (XML parser context)
792 * @param loc A SAX Locator
793 */
794typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
795 xmlSAXLocator *loc);
796/**
797 * SAX callback for start of document.
798 *
799 * @param ctx the user data (XML parser context)
800 */
801typedef void (*startDocumentSAXFunc) (void *ctx);
802/**
803 * SAX callback for end of document.
804 *
805 * @param ctx the user data (XML parser context)
806 */
807typedef void (*endDocumentSAXFunc) (void *ctx);
808/**
809 * SAX callback for start tags.
810 *
811 * @param ctx the user data (XML parser context)
812 * @param name The element name, including namespace prefix
813 * @param atts An array of name/value attributes pairs, NULL terminated
814 */
815typedef void (*startElementSAXFunc) (void *ctx,
816 const xmlChar *name,
817 const xmlChar **atts);
818/**
819 * SAX callback for end tags.
820 *
821 * @param ctx the user data (XML parser context)
822 * @param name The element name
823 */
824typedef void (*endElementSAXFunc) (void *ctx,
825 const xmlChar *name);
826/**
827 * Callback for attributes.
828 *
829 * @deprecated This typedef is unused.
830 *
831 * @param ctx the user data (XML parser context)
832 * @param name The attribute name, including namespace prefix
833 * @param value The attribute value
834 */
835typedef void (*attributeSAXFunc) (void *ctx,
836 const xmlChar *name,
837 const xmlChar *value);
838/**
839 * SAX callback for entity references.
840 *
841 * @param ctx the user data (XML parser context)
842 * @param name The entity name
843 */
844typedef void (*referenceSAXFunc) (void *ctx,
845 const xmlChar *name);
846/**
847 * SAX callback for character data.
848 *
849 * @param ctx the user data (XML parser context)
850 * @param ch a xmlChar string
851 * @param len the number of xmlChar
852 */
853typedef void (*charactersSAXFunc) (void *ctx,
854 const xmlChar *ch,
855 int len);
856/**
857 * SAX callback for "ignorable" whitespace.
858 *
859 * @param ctx the user data (XML parser context)
860 * @param ch a xmlChar string
861 * @param len the number of xmlChar
862 */
863typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
864 const xmlChar *ch,
865 int len);
866/**
867 * SAX callback for processing instructions.
868 *
869 * @param ctx the user data (XML parser context)
870 * @param target the target name
871 * @param data the PI data's
872 */
873typedef void (*processingInstructionSAXFunc) (void *ctx,
874 const xmlChar *target,
875 const xmlChar *data);
876/**
877 * SAX callback for comments.
878 *
879 * @param ctx the user data (XML parser context)
880 * @param value the comment content
881 */
882typedef void (*commentSAXFunc) (void *ctx,
883 const xmlChar *value);
884/**
885 * SAX callback for CDATA sections.
886 *
887 * @param ctx the user data (XML parser context)
888 * @param value The pcdata content
889 * @param len the block length
890 */
891typedef void (*cdataBlockSAXFunc) (
892 void *ctx,
893 const xmlChar *value,
894 int len);
895/**
896 * SAX callback for warning messages.
897 *
898 * @param ctx an XML parser context
899 * @param msg the message to display/transmit
900 * @param ... extra parameters for the message display
901 */
902typedef void (*warningSAXFunc) (void *ctx,
903 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
904/**
905 * SAX callback for error messages.
906 *
907 * @param ctx an XML parser context
908 * @param msg the message to display/transmit
909 * @param ... extra parameters for the message display
910 */
911typedef void (*errorSAXFunc) (void *ctx,
912 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
913/**
914 * SAX callback for fatal error messages.
915 *
916 * @param ctx an XML parser context
917 * @param msg the message to display/transmit
918 * @param ... extra parameters for the message display
919 */
920typedef void (*fatalErrorSAXFunc) (void *ctx,
921 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
922/**
923 * SAX callback to get standalone status.
924 *
925 * @param ctx the user data (XML parser context)
926 * @returns 1 if true
927 */
928typedef int (*isStandaloneSAXFunc) (void *ctx);
929/**
930 * SAX callback to get internal subset status.
931 *
932 * @param ctx the user data (XML parser context)
933 * @returns 1 if true
934 */
935typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
936
937/**
938 * SAX callback to get external subset status.
939 *
940 * @param ctx the user data (XML parser context)
941 * @returns 1 if true
942 */
943typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
944
945/************************************************************************
946 * *
947 * The SAX version 2 API extensions *
948 * *
949 ************************************************************************/
950/**
951 * Special constant required for SAX2 handlers.
952 */
953#define XML_SAX2_MAGIC 0xDEEDBEAF
954
955/**
956 * SAX2 callback for start tags.
957 *
958 * It provides the namespace information for the element, as well as
959 * the new namespace declarations on the element.
960 *
961 * @param ctx the user data (XML parser context)
962 * @param localname the local name of the element
963 * @param prefix the element namespace prefix if available
964 * @param URI the element namespace name if available
965 * @param nb_namespaces number of namespace definitions on that node
966 * @param namespaces pointer to the array of prefix/URI pairs namespace definitions
967 * @param nb_attributes the number of attributes on that node
968 * @param nb_defaulted the number of defaulted attributes. The defaulted
969 * ones are at the end of the array
970 * @param attributes pointer to the array of (localname/prefix/URI/value/end)
971 * attribute values.
972 */
973
974typedef void (*startElementNsSAX2Func) (void *ctx,
975 const xmlChar *localname,
976 const xmlChar *prefix,
977 const xmlChar *URI,
978 int nb_namespaces,
979 const xmlChar **namespaces,
980 int nb_attributes,
981 int nb_defaulted,
982 const xmlChar **attributes);
983
984/**
985 * SAX2 callback for end tags.
986 *
987 * It provides the namespace information for the element.
988 *
989 * @param ctx the user data (XML parser context)
990 * @param localname the local name of the element
991 * @param prefix the element namespace prefix if available
992 * @param URI the element namespace name if available
993 */
994
995typedef void (*endElementNsSAX2Func) (void *ctx,
996 const xmlChar *localname,
997 const xmlChar *prefix,
998 const xmlChar *URI);
999
1000/**
1001 * Callbacks for SAX parser
1002 *
1003 * For DTD-related handlers, it's recommended to either use the
1004 * original libxml2 handler or set them to NULL if DTDs can be
1005 * ignored.
1006 */
1007struct _xmlSAXHandler {
1008 /**
1009 * Called after the start of the document type declaration
1010 * was parsed.
1011 *
1012 * Should typically not be modified.
1013 */
1014 internalSubsetSAXFunc internalSubset;
1015 /**
1016 * Standalone status. Not invoked by the parser. Not supposed
1017 * to be changed by applications.
1018 */
1019 isStandaloneSAXFunc isStandalone;
1020 /**
1021 * Internal subset availability. Not invoked by the parser.
1022 * Not supposed to be changed by applications.
1023 */
1024 hasInternalSubsetSAXFunc hasInternalSubset;
1025 /**
1026 * External subset availability. Not invoked by the parser.
1027 * Not supposed to be changed by applications.
1028 */
1029 hasExternalSubsetSAXFunc hasExternalSubset;
1030 /**
1031 * Only called when loading external DTDs. Not called to load
1032 * external entities.
1033 *
1034 * Should typically not be modified.
1035 */
1036 resolveEntitySAXFunc resolveEntity;
1037 /**
1038 * Called when looking up general entities.
1039 *
1040 * Should typically not be modified.
1041 */
1042 getEntitySAXFunc getEntity;
1043 /**
1044 * Called after an entity declaration was parsed.
1045 *
1046 * Should typically not be modified.
1047 */
1048 entityDeclSAXFunc entityDecl;
1049 /**
1050 * Called after a notation declaration was parsed.
1051 *
1052 * Should typically not be modified.
1053 */
1054 notationDeclSAXFunc notationDecl;
1055 /**
1056 * Called after an attribute declaration was parsed.
1057 *
1058 * Should typically not be modified.
1059 */
1060 attributeDeclSAXFunc attributeDecl;
1061 /**
1062 * Called after an element declaration was parsed.
1063 *
1064 * Should typically not be modified.
1065 */
1066 elementDeclSAXFunc elementDecl;
1067 /**
1068 * Called after an unparsed entity declaration was parsed.
1069 *
1070 * Should typically not be modified.
1071 */
1072 unparsedEntityDeclSAXFunc unparsedEntityDecl;
1073 /**
1074 * This callback receives the "document locator" at startup,
1075 * which is always the global xmlDefaultSAXLocator.
1076 *
1077 * Everything is available on the context, so this is useless in
1078 * our case.
1079 */
1080 setDocumentLocatorSAXFunc setDocumentLocator;
1081 /**
1082 * Called after the XML declaration was parsed.
1083 *
1084 * Use xmlCtxtGetVersion(), xmlCtxtGetDeclaredEncoding() and
1085 * xmlCtxtGetStandalone() to get data from the XML declaration.
1086 */
1087 startDocumentSAXFunc startDocument;
1088 /**
1089 * Called at the end of the document.
1090 */
1091 endDocumentSAXFunc endDocument;
1092 /**
1093 * Legacy start tag handler
1094 *
1095 * `startElement` and `endElement` are only used by the legacy SAX1
1096 * interface and should not be used in new software. If you really
1097 * have to enable SAX1, the preferred way is set the `initialized`
1098 * member to 1 instead of XML_SAX2_MAGIC.
1099 *
1100 * For backward compatibility, it's also possible to set the
1101 * `startElementNs` and `endElementNs` handlers to NULL.
1102 *
1103 * You can also set the XML_PARSE_SAX1 parser option, but versions
1104 * older than 2.12.0 will probably crash if this option is provided
1105 * together with custom SAX callbacks.
1106 */
1107 startElementSAXFunc startElement;
1108 /**
1109 * See _xmlSAXHandler.startElement
1110 */
1111 endElementSAXFunc endElement;
1112 /**
1113 * Called after an entity reference was parsed.
1114 */
1115 referenceSAXFunc reference;
1116 /**
1117 * Called after a character data was parsed.
1118 */
1119 charactersSAXFunc characters;
1120 /**
1121 * Called after "ignorable" whitespace was parsed.
1122 *
1123 * `ignorableWhitespace` should always be set to the same value
1124 * as `characters`. Otherwise, the parser will try to detect
1125 * whitespace which is unreliable.
1126 */
1127 ignorableWhitespaceSAXFunc ignorableWhitespace;
1128 /**
1129 * Called after a processing instruction was parsed.
1130 */
1131 processingInstructionSAXFunc processingInstruction;
1132 /**
1133 * Called after a comment was parsed.
1134 */
1135 commentSAXFunc comment;
1136 /**
1137 * Callback for warning messages.
1138 */
1139 warningSAXFunc warning;
1140 /**
1141 * Callback for error messages.
1142 */
1143 errorSAXFunc error;
1144 /**
1145 * Unused, all errors go to `error`.
1146 */
1147 fatalErrorSAXFunc fatalError;
1148 /**
1149 * Called when looking up parameter entities.
1150 *
1151 * Should typically not be modified.
1152 */
1153 getParameterEntitySAXFunc getParameterEntity;
1154 /**
1155 * Called after a CDATA section was parsed.
1156 */
1157 cdataBlockSAXFunc cdataBlock;
1158 /**
1159 * Called to parse the external subset.
1160 *
1161 * Should typically not be modified.
1162 */
1163 externalSubsetSAXFunc externalSubset;
1164 /**
1165 * Legacy magic value
1166 *
1167 * `initialized` should always be set to XML_SAX2_MAGIC to
1168 * enable the modern SAX2 interface.
1169 */
1170 unsigned int initialized;
1171 /**
1172 * Application data
1173 */
1174 void *_private;
1175 /**
1176 * Called after a start tag was parsed.
1177 */
1178 startElementNsSAX2Func startElementNs;
1179 /**
1180 * Called after an end tag was parsed.
1181 */
1182 endElementNsSAX2Func endElementNs;
1183 /**
1184 * Structured error handler.
1185 *
1186 * Takes precedence over `error` or `warning`, but modern code
1187 * should use xmlCtxtSetErrorHandler().
1188 */
1189 xmlStructuredErrorFunc serror;
1190};
1191
1192/**
1193 * SAX handler, version 1.
1194 *
1195 * @deprecated Use version 2 handlers.
1196 */
1197typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
1198typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
1199/**
1200 * SAX handler, version 1.
1201 *
1202 * @deprecated Use version 2 handlers.
1203 */
1204struct _xmlSAXHandlerV1 {
1205 internalSubsetSAXFunc internalSubset;
1206 isStandaloneSAXFunc isStandalone;
1207 hasInternalSubsetSAXFunc hasInternalSubset;
1208 hasExternalSubsetSAXFunc hasExternalSubset;
1209 resolveEntitySAXFunc resolveEntity;
1210 getEntitySAXFunc getEntity;
1211 entityDeclSAXFunc entityDecl;
1212 notationDeclSAXFunc notationDecl;
1213 attributeDeclSAXFunc attributeDecl;
1214 elementDeclSAXFunc elementDecl;
1215 unparsedEntityDeclSAXFunc unparsedEntityDecl;
1216 setDocumentLocatorSAXFunc setDocumentLocator;
1217 startDocumentSAXFunc startDocument;
1218 endDocumentSAXFunc endDocument;
1219 startElementSAXFunc startElement;
1220 endElementSAXFunc endElement;
1221 referenceSAXFunc reference;
1222 charactersSAXFunc characters;
1223 ignorableWhitespaceSAXFunc ignorableWhitespace;
1224 processingInstructionSAXFunc processingInstruction;
1225 commentSAXFunc comment;
1226 warningSAXFunc warning;
1227 errorSAXFunc error;
1228 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
1229 getParameterEntitySAXFunc getParameterEntity;
1230 cdataBlockSAXFunc cdataBlock;
1231 externalSubsetSAXFunc externalSubset;
1232 unsigned int initialized;
1233};
1234
1235
1236/**
1237 * Callback for external entity loader.
1238 *
1239 * The URL is not resolved using XML catalogs before being passed
1240 * to the callback.
1241 *
1242 * @param URL The URL or system ID of the resource requested
1243 * @param publicId The public ID of the resource requested (optional)
1244 * @param context the XML parser context
1245 * @returns the entity input parser or NULL on error.
1246 */
1247typedef xmlParserInput *(*xmlExternalEntityLoader) (const char *URL,
1248 const char *publicId,
1249 xmlParserCtxt *context);
1250
1251/*
1252 * Variables
1253 */
1254
1255XMLPUBVAR const char *const xmlParserVersion;
1256
1257/** @cond ignore */
1258
1259XML_DEPRECATED
1260XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator;
1261#ifdef LIBXML_SAX1_ENABLED
1262/**
1263 * @deprecated Use #xmlSAXVersion or #xmlSAX2InitDefaultSAXHandler
1264 */
1265XML_DEPRECATED
1266XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler;
1267#endif
1268
1269XML_DEPRECATED
1270XMLPUBFUN int *__xmlDoValidityCheckingDefaultValue(void);
1271XML_DEPRECATED
1272XMLPUBFUN int *__xmlGetWarningsDefaultValue(void);
1273XML_DEPRECATED
1274XMLPUBFUN int *__xmlKeepBlanksDefaultValue(void);
1275XML_DEPRECATED
1276XMLPUBFUN int *__xmlLineNumbersDefaultValue(void);
1277XML_DEPRECATED
1278XMLPUBFUN int *__xmlLoadExtDtdDefaultValue(void);
1279XML_DEPRECATED
1280XMLPUBFUN int *__xmlPedanticParserDefaultValue(void);
1281XML_DEPRECATED
1282XMLPUBFUN int *__xmlSubstituteEntitiesDefaultValue(void);
1283
1284#ifdef LIBXML_OUTPUT_ENABLED
1285XML_DEPRECATED
1286XMLPUBFUN int *__xmlIndentTreeOutput(void);
1287XML_DEPRECATED
1288XMLPUBFUN const char **__xmlTreeIndentString(void);
1289XML_DEPRECATED
1290XMLPUBFUN int *__xmlSaveNoEmptyTags(void);
1291#endif
1292
1293/** @endcond */
1294
1295#ifndef XML_GLOBALS_NO_REDEFINITION
1296 /**
1297 * Thread-local setting to enable validation. Defaults to 0.
1298 *
1299 * @deprecated Use the parser option XML_PARSE_DTDVALID.
1300 */
1301 #define xmlDoValidityCheckingDefaultValue \
1302 (*__xmlDoValidityCheckingDefaultValue())
1303 /**
1304 * Thread-local setting to disable warnings. Defaults to 1.
1305 *
1306 * @deprecated Use the parser option XML_PARSE_NOWARNING.
1307 */
1308 #define xmlGetWarningsDefaultValue \
1309 (*__xmlGetWarningsDefaultValue())
1310 /**
1311 * Thread-local setting to ignore some whitespace. Defaults
1312 * to 1.
1313 *
1314 * @deprecated Use the parser option XML_PARSE_NOBLANKS.
1315 */
1316 #define xmlKeepBlanksDefaultValue (*__xmlKeepBlanksDefaultValue())
1317 /**
1318 * Thread-local setting to store line numbers. Defaults
1319 * to 0, but is always enabled after setting parser options.
1320 *
1321 * @deprecated Shouldn't be needed when using parser options.
1322 */
1323 #define xmlLineNumbersDefaultValue \
1324 (*__xmlLineNumbersDefaultValue())
1325 /**
1326 * Thread-local setting to enable loading of external DTDs.
1327 * Defaults to 0.
1328 *
1329 * @deprecated Use the parser option XML_PARSE_DTDLOAD.
1330 */
1331 #define xmlLoadExtDtdDefaultValue (*__xmlLoadExtDtdDefaultValue())
1332 /**
1333 * Thread-local setting to enable pedantic warnings.
1334 * Defaults to 0.
1335 *
1336 * @deprecated Use the parser option XML_PARSE_PEDANTIC.
1337 */
1338 #define xmlPedanticParserDefaultValue \
1339 (*__xmlPedanticParserDefaultValue())
1340 /**
1341 * Thread-local setting to enable entity substitution.
1342 * Defaults to 0.
1343 *
1344 * @deprecated Use the parser option XML_PARSE_NOENT.
1345 */
1346 #define xmlSubstituteEntitiesDefaultValue \
1347 (*__xmlSubstituteEntitiesDefaultValue())
1348 #ifdef LIBXML_OUTPUT_ENABLED
1349 /**
1350 * Thread-local setting to disable indenting when
1351 * formatting output. Defaults to 1.
1352 *
1353 * @deprecated Use the xmlsave.h API with option
1354 * XML_SAVE_NO_INDENT.
1355 */
1356 #define xmlIndentTreeOutput (*__xmlIndentTreeOutput())
1357 /**
1358 * Thread-local setting to change the indent string.
1359 * Defaults to two spaces.
1360 *
1361 * @deprecated Use the xmlsave.h API and
1362 * xmlSaveSetIndentString().
1363 */
1364 #define xmlTreeIndentString (*__xmlTreeIndentString())
1365 /**
1366 * Thread-local setting to disable empty tags when
1367 * serializing. Defaults to 0.
1368 *
1369 * @deprecated Use the xmlsave.h API with option
1370 * XML_SAVE_NO_EMPTY.
1371 */
1372 #define xmlSaveNoEmptyTags (*__xmlSaveNoEmptyTags())
1373 #endif
1374#endif
1375
1376/*
1377 * Init/Cleanup
1378 */
1379XMLPUBFUN void
1380 xmlInitParser (void);
1381XMLPUBFUN void
1382 xmlCleanupParser (void);
1383XML_DEPRECATED
1384XMLPUBFUN void
1385 xmlInitGlobals (void);
1386XML_DEPRECATED
1387XMLPUBFUN void
1388 xmlCleanupGlobals (void);
1389
1390/*
1391 * Input functions
1392 */
1393XML_DEPRECATED
1394XMLPUBFUN int
1395 xmlParserInputRead (xmlParserInput *in,
1396 int len);
1397XMLPUBFUN int
1398 xmlParserInputGrow (xmlParserInput *in,
1399 int len);
1400
1401/*
1402 * Basic parsing Interfaces
1403 */
1404#ifdef LIBXML_SAX1_ENABLED
1405XMLPUBFUN xmlDoc *
1406 xmlParseDoc (const xmlChar *cur);
1407XMLPUBFUN xmlDoc *
1408 xmlParseFile (const char *filename);
1409XMLPUBFUN xmlDoc *
1410 xmlParseMemory (const char *buffer,
1411 int size);
1412#endif /* LIBXML_SAX1_ENABLED */
1413XML_DEPRECATED
1414XMLPUBFUN int
1415 xmlSubstituteEntitiesDefault(int val);
1416XMLPUBFUN int
1417 xmlKeepBlanksDefault (int val);
1418XMLPUBFUN void
1419 xmlStopParser (xmlParserCtxt *ctxt);
1420XML_DEPRECATED
1421XMLPUBFUN int
1422 xmlPedanticParserDefault(int val);
1423XML_DEPRECATED
1424XMLPUBFUN int
1425 xmlLineNumbersDefault (int val);
1426
1427XML_DEPRECATED
1428XMLPUBFUN int
1429 xmlThrDefSubstituteEntitiesDefaultValue(int v);
1430XML_DEPRECATED
1431XMLPUBFUN int
1432 xmlThrDefKeepBlanksDefaultValue(int v);
1433XML_DEPRECATED
1434XMLPUBFUN int
1435 xmlThrDefPedanticParserDefaultValue(int v);
1436XML_DEPRECATED
1437XMLPUBFUN int
1438 xmlThrDefLineNumbersDefaultValue(int v);
1439XML_DEPRECATED
1440XMLPUBFUN int
1441 xmlThrDefDoValidityCheckingDefaultValue(int v);
1442XML_DEPRECATED
1443XMLPUBFUN int
1444 xmlThrDefGetWarningsDefaultValue(int v);
1445XML_DEPRECATED
1446XMLPUBFUN int
1447 xmlThrDefLoadExtDtdDefaultValue(int v);
1448
1449#ifdef LIBXML_SAX1_ENABLED
1450/*
1451 * Recovery mode
1452 */
1453XML_DEPRECATED
1454XMLPUBFUN xmlDoc *
1455 xmlRecoverDoc (const xmlChar *cur);
1456XML_DEPRECATED
1457XMLPUBFUN xmlDoc *
1458 xmlRecoverMemory (const char *buffer,
1459 int size);
1460XML_DEPRECATED
1461XMLPUBFUN xmlDoc *
1462 xmlRecoverFile (const char *filename);
1463#endif /* LIBXML_SAX1_ENABLED */
1464
1465/*
1466 * Less common routines and SAX interfaces
1467 */
1468XMLPUBFUN int
1469 xmlParseDocument (xmlParserCtxt *ctxt);
1470XML_DEPRECATED
1471XMLPUBFUN int
1472 xmlParseExtParsedEnt (xmlParserCtxt *ctxt);
1473#ifdef LIBXML_SAX1_ENABLED
1474XML_DEPRECATED
1475XMLPUBFUN int
1476 xmlSAXUserParseFile (xmlSAXHandler *sax,
1477 void *user_data,
1478 const char *filename);
1479XML_DEPRECATED
1480XMLPUBFUN int
1481 xmlSAXUserParseMemory (xmlSAXHandler *sax,
1482 void *user_data,
1483 const char *buffer,
1484 int size);
1485XML_DEPRECATED
1486XMLPUBFUN xmlDoc *
1487 xmlSAXParseDoc (xmlSAXHandler *sax,
1488 const xmlChar *cur,
1489 int recovery);
1490XML_DEPRECATED
1491XMLPUBFUN xmlDoc *
1492 xmlSAXParseMemory (xmlSAXHandler *sax,
1493 const char *buffer,
1494 int size,
1495 int recovery);
1496XML_DEPRECATED
1497XMLPUBFUN xmlDoc *
1498 xmlSAXParseMemoryWithData (xmlSAXHandler *sax,
1499 const char *buffer,
1500 int size,
1501 int recovery,
1502 void *data);
1503XML_DEPRECATED
1504XMLPUBFUN xmlDoc *
1505 xmlSAXParseFile (xmlSAXHandler *sax,
1506 const char *filename,
1507 int recovery);
1508XML_DEPRECATED
1509XMLPUBFUN xmlDoc *
1510 xmlSAXParseFileWithData (xmlSAXHandler *sax,
1511 const char *filename,
1512 int recovery,
1513 void *data);
1514XML_DEPRECATED
1515XMLPUBFUN xmlDoc *
1516 xmlSAXParseEntity (xmlSAXHandler *sax,
1517 const char *filename);
1518XML_DEPRECATED
1519XMLPUBFUN xmlDoc *
1520 xmlParseEntity (const char *filename);
1521#endif /* LIBXML_SAX1_ENABLED */
1522
1523#ifdef LIBXML_VALID_ENABLED
1524XMLPUBFUN xmlDtd *
1525 xmlCtxtParseDtd (xmlParserCtxt *ctxt,
1526 xmlParserInput *input,
1527 const xmlChar *publicId,
1528 const xmlChar *systemId);
1529XMLPUBFUN int
1530 xmlCtxtValidateDocument (xmlParserCtxt *ctxt,
1531 xmlDoc *doc);
1532XMLPUBFUN int
1533 xmlCtxtValidateDtd (xmlParserCtxt *ctxt,
1534 xmlDoc *doc,
1535 xmlDtd *dtd);
1536XML_DEPRECATED
1537XMLPUBFUN xmlDtd *
1538 xmlSAXParseDTD (xmlSAXHandler *sax,
1539 const xmlChar *publicId,
1540 const xmlChar *systemId);
1541XMLPUBFUN xmlDtd *
1542 xmlParseDTD (const xmlChar *publicId,
1543 const xmlChar *systemId);
1544XMLPUBFUN xmlDtd *
1545 xmlIOParseDTD (xmlSAXHandler *sax,
1546 xmlParserInputBuffer *input,
1547 xmlCharEncoding enc);
1548#endif /* LIBXML_VALID_ENABLE */
1549#ifdef LIBXML_SAX1_ENABLED
1550XMLPUBFUN int
1551 xmlParseBalancedChunkMemory(xmlDoc *doc,
1552 xmlSAXHandler *sax,
1553 void *user_data,
1554 int depth,
1555 const xmlChar *string,
1556 xmlNode **lst);
1557#endif /* LIBXML_SAX1_ENABLED */
1558XMLPUBFUN xmlParserErrors
1559 xmlParseInNodeContext (xmlNode *node,
1560 const char *data,
1561 int datalen,
1562 int options,
1563 xmlNode **lst);
1564#ifdef LIBXML_SAX1_ENABLED
1565XMLPUBFUN int
1566 xmlParseBalancedChunkMemoryRecover(xmlDoc *doc,
1567 xmlSAXHandler *sax,
1568 void *user_data,
1569 int depth,
1570 const xmlChar *string,
1571 xmlNode **lst,
1572 int recover);
1573XML_DEPRECATED
1574XMLPUBFUN int
1575 xmlParseExternalEntity (xmlDoc *doc,
1576 xmlSAXHandler *sax,
1577 void *user_data,
1578 int depth,
1579 const xmlChar *URL,
1580 const xmlChar *ID,
1581 xmlNode **lst);
1582#endif /* LIBXML_SAX1_ENABLED */
1583XMLPUBFUN int
1584 xmlParseCtxtExternalEntity(xmlParserCtxt *ctx,
1585 const xmlChar *URL,
1586 const xmlChar *ID,
1587 xmlNode **lst);
1588
1589/*
1590 * Parser contexts handling.
1591 */
1592XMLPUBFUN xmlParserCtxt *
1593 xmlNewParserCtxt (void);
1594XMLPUBFUN xmlParserCtxt *
1595 xmlNewSAXParserCtxt (const xmlSAXHandler *sax,
1596 void *userData);
1597XMLPUBFUN int
1598 xmlInitParserCtxt (xmlParserCtxt *ctxt);
1599XML_DEPRECATED
1600XMLPUBFUN void
1601 xmlClearParserCtxt (xmlParserCtxt *ctxt);
1602XMLPUBFUN void
1603 xmlFreeParserCtxt (xmlParserCtxt *ctxt);
1604#ifdef LIBXML_SAX1_ENABLED
1605XML_DEPRECATED
1606XMLPUBFUN void
1607 xmlSetupParserForBuffer (xmlParserCtxt *ctxt,
1608 const xmlChar* buffer,
1609 const char *filename);
1610#endif /* LIBXML_SAX1_ENABLED */
1611XMLPUBFUN xmlParserCtxt *
1612 xmlCreateDocParserCtxt (const xmlChar *cur);
1613
1614#ifdef LIBXML_PUSH_ENABLED
1615/*
1616 * Interfaces for the Push mode.
1617 */
1618XMLPUBFUN xmlParserCtxt *
1619 xmlCreatePushParserCtxt(xmlSAXHandler *sax,
1620 void *user_data,
1621 const char *chunk,
1622 int size,
1623 const char *filename);
1624XMLPUBFUN int
1625 xmlParseChunk (xmlParserCtxt *ctxt,
1626 const char *chunk,
1627 int size,
1628 int terminate);
1629#endif /* LIBXML_PUSH_ENABLED */
1630
1631/*
1632 * Special I/O mode.
1633 */
1634
1635XMLPUBFUN xmlParserCtxt *
1636 xmlCreateIOParserCtxt (xmlSAXHandler *sax,
1637 void *user_data,
1638 xmlInputReadCallback ioread,
1639 xmlInputCloseCallback ioclose,
1640 void *ioctx,
1641 xmlCharEncoding enc);
1642
1643XMLPUBFUN xmlParserInput *
1644 xmlNewIOInputStream (xmlParserCtxt *ctxt,
1645 xmlParserInputBuffer *input,
1646 xmlCharEncoding enc);
1647
1648/*
1649 * Node infos.
1650 */
1651XML_DEPRECATED
1652XMLPUBFUN const xmlParserNodeInfo*
1653 xmlParserFindNodeInfo (xmlParserCtxt *ctxt,
1654 xmlNode *node);
1655XML_DEPRECATED
1656XMLPUBFUN void
1657 xmlInitNodeInfoSeq (xmlParserNodeInfoSeq *seq);
1658XML_DEPRECATED
1659XMLPUBFUN void
1660 xmlClearNodeInfoSeq (xmlParserNodeInfoSeq *seq);
1661XML_DEPRECATED
1662XMLPUBFUN unsigned long
1663 xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeq *seq,
1664 xmlNode *node);
1665XML_DEPRECATED
1666XMLPUBFUN void
1667 xmlParserAddNodeInfo (xmlParserCtxt *ctxt,
1668 xmlParserNodeInfo *info);
1669
1670/*
1671 * External entities handling actually implemented in xmlIO.
1672 */
1673
1674XMLPUBFUN void
1675 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1676XMLPUBFUN xmlExternalEntityLoader
1677 xmlGetExternalEntityLoader(void);
1678XMLPUBFUN xmlParserInput *
1679 xmlLoadExternalEntity (const char *URL,
1680 const char *ID,
1681 xmlParserCtxt *ctxt);
1682
1683XML_DEPRECATED
1684XMLPUBFUN long
1685 xmlByteConsumed (xmlParserCtxt *ctxt);
1686
1687/*
1688 * New set of simpler/more flexible APIs
1689 */
1690
1691/**
1692 * This is the set of XML parser options that can be passed to
1693 * #xmlReadDoc, #xmlCtxtSetOptions and other functions.
1694 */
1695typedef enum {
1696 /**
1697 * Enable "recovery" mode which allows non-wellformed documents.
1698 * How this mode behaves exactly is unspecified and may change
1699 * without further notice. Use of this feature is DISCOURAGED.
1700 *
1701 * Not supported by the push parser.
1702 */
1703 XML_PARSE_RECOVER = 1<<0,
1704 /**
1705 * Despite the confusing name, this option enables substitution
1706 * of entities. The resulting tree won't contain any entity
1707 * reference nodes.
1708 *
1709 * This option also enables loading of external entities (both
1710 * general and parameter entities) which is dangerous. If you
1711 * process untrusted data, it's recommended to set the
1712 * XML_PARSE_NO_XXE option to disable loading of external
1713 * entities.
1714 */
1715 XML_PARSE_NOENT = 1<<1,
1716 /**
1717 * Enables loading of an external DTD and the loading and
1718 * substitution of external parameter entities. Has no effect
1719 * if XML_PARSE_NO_XXE is set.
1720 */
1721 XML_PARSE_DTDLOAD = 1<<2,
1722 /**
1723 * Adds default attributes from the DTD to the result document.
1724 *
1725 * Implies XML_PARSE_DTDLOAD, but loading of external content
1726 * can be disabled with XML_PARSE_NO_XXE.
1727 */
1728 XML_PARSE_DTDATTR = 1<<3,
1729 /**
1730 * This option enables DTD validation which requires to load
1731 * external DTDs and external entities (both general and
1732 * parameter entities) unless XML_PARSE_NO_XXE was set.
1733 *
1734 * DTD validation is vulnerable to algorithmic complexity
1735 * attacks and should never be enabled with untrusted input.
1736 */
1737 XML_PARSE_DTDVALID = 1<<4,
1738 /**
1739 * Disable error and warning reports to the error handlers.
1740 * Errors are still accessible with xmlCtxtGetLastError().
1741 */
1742 XML_PARSE_NOERROR = 1<<5,
1743 /**
1744 * Disable warning reports.
1745 */
1746 XML_PARSE_NOWARNING = 1<<6,
1747 /**
1748 * Enable some pedantic warnings.
1749 */
1750 XML_PARSE_PEDANTIC = 1<<7,
1751 /**
1752 * Remove some whitespace from the result document. Where to
1753 * remove whitespace depends on DTD element declarations or a
1754 * broken heuristic with unfixable bugs. Use of this option is
1755 * DISCOURAGED.
1756 *
1757 * Not supported by the push parser.
1758 */
1759 XML_PARSE_NOBLANKS = 1<<8,
1760 /**
1761 * Always invoke the deprecated SAX1 startElement and endElement
1762 * handlers.
1763 *
1764 * @deprecated This option will be removed in a future version.
1765 */
1766 XML_PARSE_SAX1 = 1<<9,
1767 /**
1768 * Enable XInclude processing. This option only affects the
1769 * xmlTextReader and XInclude interfaces.
1770 */
1771 XML_PARSE_XINCLUDE = 1<<10,
1772 /**
1773 * Disable network access with the built-in HTTP or FTP clients.
1774 *
1775 * After the last built-in network client was removed in 2.15,
1776 * this option has no effect expect for being passed on to custom
1777 * resource loaders.
1778 */
1779 XML_PARSE_NONET = 1<<11,
1780 /**
1781 * Create a document without interned strings, making all
1782 * strings separate memory allocations.
1783 */
1784 XML_PARSE_NODICT = 1<<12,
1785 /**
1786 * Remove redundant namespace declarations from the result
1787 * document.
1788 */
1789 XML_PARSE_NSCLEAN = 1<<13,
1790 /**
1791 * Output normal text nodes instead of CDATA nodes.
1792 */
1793 XML_PARSE_NOCDATA = 1<<14,
1794 /**
1795 * Don't generate XInclude start/end nodes when expanding
1796 * inclusions. This option only affects the xmlTextReader
1797 * and XInclude interfaces.
1798 */
1799 XML_PARSE_NOXINCNODE = 1<<15,
1800 /**
1801 * Store small strings directly in the node struct to save
1802 * memory.
1803 */
1804 XML_PARSE_COMPACT = 1<<16,
1805 /**
1806 * Use old Name productions from before XML 1.0 Fifth Edition.
1807 *
1808 * @deprecated This option will be removed in a future version.
1809 */
1810 XML_PARSE_OLD10 = 1<<17,
1811 /**
1812 * Don't fix up XInclude xml:base URIs. This option only affects
1813 * the xmlTextReader and XInclude interfaces.
1814 */
1815 XML_PARSE_NOBASEFIX = 1<<18,
1816 /**
1817 * Relax some internal limits.
1818 *
1819 * Maximum size of text nodes, tags, comments, processing instructions,
1820 * CDATA sections, entity values
1821 *
1822 * normal: 10M
1823 * huge: 1B
1824 *
1825 * Maximum size of names, system literals, pubid literals
1826 *
1827 * normal: 50K
1828 * huge: 10M
1829 *
1830 * Maximum nesting depth of elements
1831 *
1832 * normal: 256
1833 * huge: 2048
1834 *
1835 * Maximum nesting depth of entities
1836 *
1837 * normal: 20
1838 * huge: 40
1839 */
1840 XML_PARSE_HUGE = 1<<19,
1841 /**
1842 * Enable an unspecified legacy mode for SAX parsers.
1843 *
1844 * @deprecated This option will be removed in a future version.
1845 */
1846 XML_PARSE_OLDSAX = 1<<20,
1847 /**
1848 * Ignore the encoding in the XML declaration. This option is
1849 * mostly unneeded these days. The only effect is to enforce
1850 * UTF-8 decoding of ASCII-like data.
1851 */
1852 XML_PARSE_IGNORE_ENC = 1<<21,
1853 /**
1854 * Enable reporting of line numbers larger than 65535.
1855 */
1856 XML_PARSE_BIG_LINES = 1<<22,
1857 /**
1858 * Disables loading of external DTDs or entities.
1859 *
1860 * @since 2.13.0
1861 */
1862 XML_PARSE_NO_XXE = 1<<23,
1863 /**
1864 * Enable input decompression. Setting this option is discouraged
1865 * to avoid zip bombs.
1866 *
1867 * @since 2.14.0
1868 */
1869 XML_PARSE_UNZIP = 1<<24,
1870 /**
1871 * Disables the global system XML catalog.
1872 *
1873 * @since 2.14.0
1874 */
1875 XML_PARSE_NO_SYS_CATALOG = 1<<25,
1876 /**
1877 * Enable XML catalog processing instructions.
1878 *
1879 * @since 2.14.0
1880 */
1881 XML_PARSE_CATALOG_PI = 1<<26,
1882 /**
1883 * Force the parser to ignore IDs.
1884 *
1885 * @since 2.15.0
1886 */
1887 XML_PARSE_SKIP_IDS = 1<<27
1888} xmlParserOption;
1889
1890XMLPUBFUN void
1891 xmlCtxtReset (xmlParserCtxt *ctxt);
1892XMLPUBFUN int
1893 xmlCtxtResetPush (xmlParserCtxt *ctxt,
1894 const char *chunk,
1895 int size,
1896 const char *filename,
1897 const char *encoding);
1898XMLPUBFUN int
1899 xmlCtxtGetOptions (xmlParserCtxt *ctxt);
1900XMLPUBFUN int
1901 xmlCtxtSetOptions (xmlParserCtxt *ctxt,
1902 int options);
1903XMLPUBFUN int
1904 xmlCtxtUseOptions (xmlParserCtxt *ctxt,
1905 int options);
1906XMLPUBFUN void *
1907 xmlCtxtGetPrivate (xmlParserCtxt *ctxt);
1908XMLPUBFUN void
1909 xmlCtxtSetPrivate (xmlParserCtxt *ctxt,
1910 void *priv);
1911XMLPUBFUN void *
1912 xmlCtxtGetCatalogs (xmlParserCtxt *ctxt);
1913XMLPUBFUN void
1914 xmlCtxtSetCatalogs (xmlParserCtxt *ctxt,
1915 void *catalogs);
1916XMLPUBFUN xmlDict *
1917 xmlCtxtGetDict (xmlParserCtxt *ctxt);
1918XMLPUBFUN void
1919 xmlCtxtSetDict (xmlParserCtxt *ctxt,
1920 xmlDict *);
1921XMLPUBFUN xmlSAXHandler *
1922 xmlCtxtGetSaxHandler (xmlParserCtxt *ctxt);
1923XMLPUBFUN int
1924 xmlCtxtSetSaxHandler (xmlParserCtxt *ctxt,
1925 const xmlSAXHandler *sax);
1926XMLPUBFUN xmlDoc *
1927 xmlCtxtGetDocument (xmlParserCtxt *ctxt);
1928XMLPUBFUN int
1929 xmlCtxtIsHtml (xmlParserCtxt *ctxt);
1930XMLPUBFUN int
1931 xmlCtxtIsStopped (xmlParserCtxt *ctxt);
1932XMLPUBFUN int
1933 xmlCtxtIsInSubset (xmlParserCtxt *ctxt);
1934#ifdef LIBXML_VALID_ENABLED
1935XMLPUBFUN xmlValidCtxt *
1936 xmlCtxtGetValidCtxt (xmlParserCtxt *ctxt);
1937#endif
1938XMLPUBFUN const xmlChar *
1939 xmlCtxtGetVersion (xmlParserCtxt *ctxt);
1940XMLPUBFUN const xmlChar *
1941 xmlCtxtGetDeclaredEncoding(xmlParserCtxt *ctxt);
1942XMLPUBFUN int
1943 xmlCtxtGetStandalone (xmlParserCtxt *ctxt);
1944XMLPUBFUN xmlParserStatus
1945 xmlCtxtGetStatus (xmlParserCtxt *ctxt);
1946XMLPUBFUN void *
1947 xmlCtxtGetUserData (xmlParserCtxt *ctxt);
1948XMLPUBFUN xmlNode *
1949 xmlCtxtGetNode (xmlParserCtxt *ctxt);
1950XMLPUBFUN int
1951 xmlCtxtGetDocTypeDecl (xmlParserCtxt *ctxt,
1952 const xmlChar **name,
1953 const xmlChar **systemId,
1954 const xmlChar **publicId);
1955XMLPUBFUN int
1956 xmlCtxtGetInputPosition (xmlParserCtxt *ctxt,
1957 int inputIndex,
1958 const char **filname,
1959 int *line,
1960 int *col,
1961 unsigned long *bytePos);
1962XMLPUBFUN int
1963 xmlCtxtGetInputWindow (xmlParserCtxt *ctxt,
1964 int inputIndex,
1965 const xmlChar **startOut,
1966 int *sizeInOut,
1967 int *offsetOut);
1968XMLPUBFUN void
1969 xmlCtxtSetErrorHandler (xmlParserCtxt *ctxt,
1970 xmlStructuredErrorFunc handler,
1971 void *data);
1972XMLPUBFUN void
1973 xmlCtxtSetResourceLoader(xmlParserCtxt *ctxt,
1974 xmlResourceLoader loader,
1975 void *vctxt);
1976XMLPUBFUN void
1977 xmlCtxtSetCharEncConvImpl(xmlParserCtxt *ctxt,
1978 xmlCharEncConvImpl impl,
1979 void *vctxt);
1980XMLPUBFUN void
1981 xmlCtxtSetMaxAmplification(xmlParserCtxt *ctxt,
1982 unsigned maxAmpl);
1983XMLPUBFUN xmlDoc *
1984 xmlReadDoc (const xmlChar *cur,
1985 const char *URL,
1986 const char *encoding,
1987 int options);
1988XMLPUBFUN xmlDoc *
1989 xmlReadFile (const char *URL,
1990 const char *encoding,
1991 int options);
1992XMLPUBFUN xmlDoc *
1993 xmlReadMemory (const char *buffer,
1994 int size,
1995 const char *URL,
1996 const char *encoding,
1997 int options);
1998XMLPUBFUN xmlDoc *
1999 xmlReadFd (int fd,
2000 const char *URL,
2001 const char *encoding,
2002 int options);
2003XMLPUBFUN xmlDoc *
2004 xmlReadIO (xmlInputReadCallback ioread,
2005 xmlInputCloseCallback ioclose,
2006 void *ioctx,
2007 const char *URL,
2008 const char *encoding,
2009 int options);
2010XMLPUBFUN xmlDoc *
2011 xmlCtxtParseDocument (xmlParserCtxt *ctxt,
2012 xmlParserInput *input);
2013XMLPUBFUN xmlNode *
2014 xmlCtxtParseContent (xmlParserCtxt *ctxt,
2015 xmlParserInput *input,
2016 xmlNode *node,
2017 int hasTextDecl);
2018XMLPUBFUN xmlDoc *
2019 xmlCtxtReadDoc (xmlParserCtxt *ctxt,
2020 const xmlChar *cur,
2021 const char *URL,
2022 const char *encoding,
2023 int options);
2024XMLPUBFUN xmlDoc *
2025 xmlCtxtReadFile (xmlParserCtxt *ctxt,
2026 const char *filename,
2027 const char *encoding,
2028 int options);
2029XMLPUBFUN xmlDoc *
2030 xmlCtxtReadMemory (xmlParserCtxt *ctxt,
2031 const char *buffer,
2032 int size,
2033 const char *URL,
2034 const char *encoding,
2035 int options);
2036XMLPUBFUN xmlDoc *
2037 xmlCtxtReadFd (xmlParserCtxt *ctxt,
2038 int fd,
2039 const char *URL,
2040 const char *encoding,
2041 int options);
2042XMLPUBFUN xmlDoc *
2043 xmlCtxtReadIO (xmlParserCtxt *ctxt,
2044 xmlInputReadCallback ioread,
2045 xmlInputCloseCallback ioclose,
2046 void *ioctx,
2047 const char *URL,
2048 const char *encoding,
2049 int options);
2050
2051/*
2052 * New input API
2053 */
2054
2055XMLPUBFUN xmlParserErrors
2056xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags,
2057 xmlParserInput **out);
2058XMLPUBFUN xmlParserInput *
2059xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
2060 xmlParserInputFlags flags);
2061XMLPUBFUN xmlParserInput *
2062xmlNewInputFromString(const char *url, const char *str,
2063 xmlParserInputFlags flags);
2064XMLPUBFUN xmlParserInput *
2065xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags);
2066XMLPUBFUN xmlParserInput *
2067xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
2068 xmlInputCloseCallback ioClose, void *ioCtxt,
2069 xmlParserInputFlags flags);
2070XMLPUBFUN xmlParserErrors
2071xmlInputSetEncodingHandler(xmlParserInput *input,
2072 xmlCharEncodingHandler *handler);
2073
2074/*
2075 * Library wide options
2076 */
2077
2078/**
2079 * Used to examine the existence of features that can be enabled
2080 * or disabled at compile-time.
2081 * They used to be called XML_FEATURE_xxx but this clashed with Expat
2082 */
2083typedef enum {
2084 /** Multithreading support */
2085 XML_WITH_THREAD = 1,
2086 /** @deprecated Always available */
2087 XML_WITH_TREE = 2,
2088 /** Serialization support */
2089 XML_WITH_OUTPUT = 3,
2090 /** Push parser */
2091 XML_WITH_PUSH = 4,
2092 /** XML Reader */
2093 XML_WITH_READER = 5,
2094 /** Streaming patterns */
2095 XML_WITH_PATTERN = 6,
2096 /** XML Writer */
2097 XML_WITH_WRITER = 7,
2098 /** Legacy SAX1 API */
2099 XML_WITH_SAX1 = 8,
2100 /** @deprecated FTP support was removed */
2101 XML_WITH_FTP = 9,
2102 /** @deprecated HTTP support was removed */
2103 XML_WITH_HTTP = 10,
2104 /** DTD validation */
2105 XML_WITH_VALID = 11,
2106 /** HTML parser */
2107 XML_WITH_HTML = 12,
2108 /** Legacy symbols */
2109 XML_WITH_LEGACY = 13,
2110 /** Canonical XML */
2111 XML_WITH_C14N = 14,
2112 /** XML Catalogs */
2113 XML_WITH_CATALOG = 15,
2114 /** XPath */
2115 XML_WITH_XPATH = 16,
2116 /** XPointer */
2117 XML_WITH_XPTR = 17,
2118 /** XInclude */
2119 XML_WITH_XINCLUDE = 18,
2120 /** iconv */
2121 XML_WITH_ICONV = 19,
2122 /** Built-in ISO-8859-X */
2123 XML_WITH_ISO8859X = 20,
2124 /** @deprecated Removed */
2125 XML_WITH_UNICODE = 21,
2126 /** Regular expressions */
2127 XML_WITH_REGEXP = 22,
2128 /** @deprecated Same as XML_WITH_REGEXP */
2129 XML_WITH_AUTOMATA = 23,
2130 /** @deprecated Removed */
2131 XML_WITH_EXPR = 24,
2132 /** XML Schemas */
2133 XML_WITH_SCHEMAS = 25,
2134 /** Schematron */
2135 XML_WITH_SCHEMATRON = 26,
2136 /** Loadable modules */
2137 XML_WITH_MODULES = 27,
2138 /** Debugging API */
2139 XML_WITH_DEBUG = 28,
2140 /** @deprecated Removed */
2141 XML_WITH_DEBUG_MEM = 29,
2142 /** @deprecated Removed */
2143 XML_WITH_DEBUG_RUN = 30,
2144 /** GZIP compression */
2145 XML_WITH_ZLIB = 31,
2146 /** ICU */
2147 XML_WITH_ICU = 32,
2148 /** @deprecated LZMA support was removed */
2149 XML_WITH_LZMA = 33,
2150 /** RELAXNG, since 2.14 */
2151 XML_WITH_RELAXNG = 34,
2152 XML_WITH_NONE = 99999 /* just to be sure of allocation size */
2153} xmlFeature;
2154
2155XMLPUBFUN int
2156 xmlHasFeature (xmlFeature feature);
2157
2158#ifdef __cplusplus
2159}
2160#endif
2161#endif /* __XML_PARSER_H__ */
2162