Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:14:14

0001 /**
0002  * @file
0003  * 
0004  * @brief Validating XML 1.0 parser
0005  * 
0006  * Interfaces, constants and types related to the XML parser.
0007  *
0008  * @copyright See Copyright for the status of this software.
0009  *
0010  * @author Daniel Veillard
0011  */
0012 
0013 #ifndef __XML_PARSER_H__
0014 #define __XML_PARSER_H__
0015 
0016 #include <libxml/xmlversion.h>
0017 /** @cond ignore */
0018 #define XML_TREE_INTERNALS
0019 /** @endcond */
0020 #include <libxml/tree.h>
0021 #undef XML_TREE_INTERNALS
0022 #include <libxml/dict.h>
0023 #include <libxml/hash.h>
0024 #include <libxml/valid.h>
0025 #include <libxml/entities.h>
0026 #include <libxml/xmlerror.h>
0027 #include <libxml/xmlstring.h>
0028 #include <libxml/xmlmemory.h>
0029 #include <libxml/encoding.h>
0030 #include <libxml/xmlIO.h>
0031 /* for compatibility */
0032 #include <libxml/SAX2.h>
0033 #include <libxml/threads.h>
0034 
0035 #ifdef __cplusplus
0036 extern "C" {
0037 #endif
0038 
0039 /**
0040  * The default version of XML used: 1.0
0041  */
0042 #define XML_DEFAULT_VERSION "1.0"
0043 
0044 /**
0045  * Status after parsing a document
0046  */
0047 typedef enum {
0048     /** not well-formed */
0049     XML_STATUS_NOT_WELL_FORMED          = (1 << 0),
0050     /** not namespace-well-formed */
0051     XML_STATUS_NOT_NS_WELL_FORMED       = (1 << 1),
0052     /** DTD validation failed */
0053     XML_STATUS_DTD_VALIDATION_FAILED    = (1 << 2),
0054     /** catastrophic failure like OOM or I/O error */
0055     XML_STATUS_CATASTROPHIC_ERROR       = (1 << 3)
0056 } xmlParserStatus;
0057 
0058 /**
0059  * Resource type for resource loaders
0060  */
0061 typedef enum {
0062     /** unknown */
0063     XML_RESOURCE_UNKNOWN = 0,
0064     /** main document */
0065     XML_RESOURCE_MAIN_DOCUMENT,
0066     /** external DTD */
0067     XML_RESOURCE_DTD,
0068     /** external general entity */
0069     XML_RESOURCE_GENERAL_ENTITY,
0070     /** external parameter entity */
0071     XML_RESOURCE_PARAMETER_ENTITY,
0072     /** XIncluded document */
0073     XML_RESOURCE_XINCLUDE,
0074     /** XIncluded text */
0075     XML_RESOURCE_XINCLUDE_TEXT
0076 } xmlResourceType;
0077 
0078 /**
0079  * Flags for parser input
0080  */
0081 typedef enum {
0082     /** The input buffer won't be changed during parsing. */
0083     XML_INPUT_BUF_STATIC            = (1 << 1),
0084     /** The input buffer is zero-terminated. (Note that the zero
0085         byte shouldn't be included in buffer size.) */
0086     XML_INPUT_BUF_ZERO_TERMINATED   = (1 << 2),
0087     /** Uncompress gzipped file input */
0088     XML_INPUT_UNZIP                 = (1 << 3),
0089     /** Allow network access. Unused internally. */
0090     XML_INPUT_NETWORK               = (1 << 4),
0091     /** Allow system catalog to resolve URIs. */
0092     XML_INPUT_USE_SYS_CATALOG       = (1 << 5)
0093 } xmlParserInputFlags;
0094 
0095 /* Deprecated */
0096 typedef void (* xmlParserInputDeallocate)(xmlChar *str);
0097 
0098 /**
0099  * Parser input
0100  */
0101 struct _xmlParserInput {
0102     /* Input buffer */
0103     xmlParserInputBuffer *buf XML_DEPRECATED_MEMBER;
0104     /**
0105      * @deprecated Use #xmlCtxtGetInputPosition
0106      *
0107      * The filename or URI, if any
0108      */
0109     const char *filename;
0110     /* unused */
0111     const char *directory XML_DEPRECATED_MEMBER;
0112     /* Base of the array to parse */
0113     const xmlChar *base;
0114     /**
0115      * @deprecated Use #xmlCtxtGetInputWindow
0116      *
0117      * Current char being parsed
0118      */
0119     const xmlChar *cur;
0120     /* end of the array to parse */
0121     const xmlChar *end;
0122     /* unused */
0123     int length XML_DEPRECATED_MEMBER;
0124     /**
0125      * @deprecated Use #xmlCtxtGetInputPosition
0126      *
0127      * Current line
0128      */
0129     int line;
0130     /**
0131      * @deprecated Use #xmlCtxtGetInputPosition
0132      *
0133      * Current column
0134      */
0135     int col;
0136     /**
0137      * @deprecated Use #xmlCtxtGetInputPosition
0138      *
0139      * How many xmlChars already consumed
0140      */
0141     unsigned long consumed;
0142     /* function to deallocate the base */
0143     xmlParserInputDeallocate free XML_DEPRECATED_MEMBER;
0144     /* unused */
0145     const xmlChar *encoding XML_DEPRECATED_MEMBER;
0146     /* the version string for entity */
0147     const xmlChar *version XML_DEPRECATED_MEMBER;
0148     /* Flags */
0149     int flags XML_DEPRECATED_MEMBER;
0150     /* an unique identifier for the entity, unused internally */
0151     int id XML_DEPRECATED_MEMBER;
0152     /* unused */
0153     unsigned long parentConsumed XML_DEPRECATED_MEMBER;
0154     /* entity, if any */
0155     xmlEntity *entity XML_DEPRECATED_MEMBER;
0156 };
0157 
0158 /** @cond ignore */
0159 
0160 typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
0161 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
0162 
0163 struct _xmlParserNodeInfo {
0164   const struct _xmlNode* node;
0165   /* Position & line # that text that created the node begins & ends on */
0166   unsigned long begin_pos;
0167   unsigned long begin_line;
0168   unsigned long end_pos;
0169   unsigned long end_line;
0170 };
0171 
0172 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
0173 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
0174 struct _xmlParserNodeInfoSeq {
0175   unsigned long maximum;
0176   unsigned long length;
0177   xmlParserNodeInfo* buffer;
0178 };
0179 
0180 /*
0181  * Internal type
0182  */
0183 typedef enum {
0184     XML_PARSER_EOF = -1,    /* nothing is to be parsed */
0185     XML_PARSER_START = 0,   /* nothing has been parsed */
0186     XML_PARSER_MISC,        /* Misc* before int subset */
0187     XML_PARSER_PI,      /* Within a processing instruction */
0188     XML_PARSER_DTD,     /* within some DTD content */
0189     XML_PARSER_PROLOG,      /* Misc* after internal subset */
0190     XML_PARSER_COMMENT,     /* within a comment */
0191     XML_PARSER_START_TAG,   /* within a start tag */
0192     XML_PARSER_CONTENT,     /* within the content */
0193     XML_PARSER_CDATA_SECTION,   /* within a CDATA section */
0194     XML_PARSER_END_TAG,     /* within a closing tag */
0195     XML_PARSER_ENTITY_DECL, /* within an entity declaration */
0196     XML_PARSER_ENTITY_VALUE,    /* within an entity value in a decl */
0197     XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
0198     XML_PARSER_SYSTEM_LITERAL,  /* within a SYSTEM value */
0199     XML_PARSER_EPILOG,      /* the Misc* after the last end tag */
0200     XML_PARSER_IGNORE,      /* within an IGNORED section */
0201     XML_PARSER_PUBLIC_LITERAL,  /* within a PUBLIC value */
0202     XML_PARSER_XML_DECL         /* before XML decl (but after BOM) */
0203 } xmlParserInputState;
0204 
0205 /*
0206  * Internal bits in the 'loadsubset' context member
0207  */
0208 #define XML_DETECT_IDS      2
0209 #define XML_COMPLETE_ATTRS  4
0210 #define XML_SKIP_IDS        8
0211 
0212 /*
0213  * Internal type. Only XML_PARSE_READER is used.
0214  */
0215 typedef enum {
0216     XML_PARSE_UNKNOWN = 0,
0217     XML_PARSE_DOM = 1,
0218     XML_PARSE_SAX = 2,
0219     XML_PARSE_PUSH_DOM = 3,
0220     XML_PARSE_PUSH_SAX = 4,
0221     XML_PARSE_READER = 5
0222 } xmlParserMode;
0223 
0224 typedef struct _xmlStartTag xmlStartTag;
0225 typedef struct _xmlParserNsData xmlParserNsData;
0226 typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
0227 
0228 /** @endcond */
0229 
0230 /**
0231  * Callback for custom resource loaders.
0232  *
0233  * `flags` can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK.
0234  *
0235  * The URL is resolved using XML catalogs before being passed to
0236  * the callback.
0237  *
0238  * On success, `out` should be set to a new parser input object and
0239  * XML_ERR_OK should be returned.
0240  *
0241  * @param ctxt  parser context
0242  * @param url  URL or system ID to load
0243  * @param publicId  publid ID from DTD (optional)
0244  * @param type  resource type
0245  * @param flags  flags
0246  * @param out  result pointer
0247  * @returns an xmlParserErrors code.
0248  */
0249 typedef xmlParserErrors
0250 (*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
0251                      xmlResourceType type, xmlParserInputFlags flags,
0252                      xmlParserInput **out);
0253 
0254 /**
0255  * Parser context
0256  */
0257 struct _xmlParserCtxt {
0258     /**
0259      * @deprecated Use xmlCtxtGetSaxHandler() and
0260      * xmlCtxtSetSaxHandler().
0261      *
0262      * the SAX handler
0263      */
0264     struct _xmlSAXHandler *sax;
0265     /**
0266      * @deprecated Use #xmlCtxtGetUserData
0267      *
0268      * user data for SAX interface, defaults to the context itself
0269      */
0270     void *userData;
0271     /**
0272      * @deprecated Use xmlCtxtGetDocument()
0273      *
0274      * the document being built
0275      */
0276     xmlDoc *myDoc;
0277     /**
0278      * @deprecated Use xmlCtxtGetStatus()
0279      *
0280      * is the document well formed?
0281      */
0282     int wellFormed;
0283     /**
0284      * @deprecated Use xmlParserOption XML_PARSE_NOENT
0285      *
0286      * shall we replace entities?
0287      */
0288     int replaceEntities XML_DEPRECATED_MEMBER;
0289     /**
0290      * @deprecated Use xmlCtxtGetVersion()
0291      *
0292      * the XML version string
0293      */
0294     xmlChar *version;
0295     /**
0296      * @deprecated Use xmlCtxtGetDeclaredEncoding()
0297      *
0298      * the declared encoding, if any
0299      */
0300     xmlChar *encoding;
0301     /**
0302      * @deprecated Use xmlCtxtGetStandalone()
0303      *
0304      * standalone document
0305      */
0306     int standalone;
0307 
0308     /**
0309      * @deprecated Use xmlCtxtIsHtml()
0310      *
0311      * non-zero for HTML documents, actually an htmlInsertMode
0312      */
0313     int html;
0314 
0315     /* Input stream stack */
0316 
0317     /**
0318      * Current input stream
0319      */
0320     /* TODO: Add accessors, see issue #762 */
0321     xmlParserInput *input;
0322     /* Number of current input streams */
0323     int inputNr;
0324     /* Max number of input streams */
0325     int inputMax XML_DEPRECATED_MEMBER;
0326     /* stack of inputs */
0327     xmlParserInput **inputTab;
0328 
0329     /* Node analysis stack only used for DOM building */
0330 
0331     /**
0332      * @deprecated Use #xmlCtxtGetNode
0333      *
0334      * The current element.
0335      */
0336     xmlNode *node;
0337     /* Depth of the parsing stack */
0338     int nodeNr XML_DEPRECATED_MEMBER;
0339     /* Max depth of the parsing stack */
0340     int nodeMax XML_DEPRECATED_MEMBER;
0341     /* array of nodes */
0342     xmlNode **nodeTab XML_DEPRECATED_MEMBER;
0343 
0344     /* Whether node info should be kept */
0345     int record_info;
0346     /* info about each node parsed */
0347     xmlParserNodeInfoSeq node_seq XML_DEPRECATED_MEMBER;
0348 
0349     /**
0350      * @deprecated Use xmlCtxtGetLastError()
0351      *
0352      * error code
0353      */
0354     int errNo;
0355 
0356     /* reference and external subset */
0357     int hasExternalSubset XML_DEPRECATED_MEMBER;
0358     /* the internal subset has PE refs */
0359     int hasPErefs XML_DEPRECATED_MEMBER;
0360     /* unused */
0361     int external XML_DEPRECATED_MEMBER;
0362 
0363     /**
0364      * @deprecated Use xmlCtxtGetStatus()
0365      *
0366      * is the document valid
0367      */
0368     int valid;
0369     /**
0370      * @deprecated Use xmlParserOption XML_PARSE_DTDVALID
0371      *
0372      * shall we try to validate?
0373      */
0374     int validate XML_DEPRECATED_MEMBER;
0375     /**
0376      * @deprecated Use xmlCtxtGetValidCtxt()
0377      *
0378      * The validity context
0379      */
0380     xmlValidCtxt vctxt;
0381 
0382     /* push parser state */
0383     xmlParserInputState instate XML_DEPRECATED_MEMBER;
0384     /* unused */
0385     int token XML_DEPRECATED_MEMBER;
0386 
0387     /**
0388      * @deprecated Don't use
0389      *
0390      * The main document URI, if available, with its last
0391      * component stripped.
0392      */
0393     char *directory;
0394 
0395     /* Node name stack */
0396 
0397     /* Current parsed Node */
0398     const xmlChar *name XML_DEPRECATED_MEMBER;
0399     /* Depth of the parsing stack */
0400     int nameNr XML_DEPRECATED_MEMBER;
0401     /* Max depth of the parsing stack */
0402     int nameMax XML_DEPRECATED_MEMBER;
0403     /* array of nodes */
0404     const xmlChar **nameTab XML_DEPRECATED_MEMBER;
0405 
0406     /* unused */
0407     long nbChars XML_DEPRECATED_MEMBER;
0408     /* used by progressive parsing lookup */
0409     long checkIndex XML_DEPRECATED_MEMBER;
0410     /**
0411      * @deprecated Use inverted xmlParserOption XML_PARSE_NOBLANKS
0412      *
0413      * ugly but ...
0414      */
0415     int keepBlanks XML_DEPRECATED_MEMBER;
0416     /**
0417      * @deprecated Use xmlCtxtIsStopped()
0418      *
0419      * SAX callbacks are disabled
0420      */
0421     int disableSAX XML_DEPRECATED_MEMBER;
0422     /**
0423      * @deprecated Use xmlCtxtIsInSubset
0424      *
0425      * Set if DTD content is parsed.
0426      *
0427      * - 0: not in DTD
0428      * - 1: in internal DTD subset
0429      * - 2: in external DTD subset
0430      */
0431     int inSubset;
0432     /**
0433      * @deprecated Use the `name` argument of the
0434      * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
0435      *
0436      * Name of the internal subset (root element type).
0437      */
0438     const xmlChar *intSubName;
0439     /**
0440      * @deprecated Use the `systemId` argument of the
0441      * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
0442      *
0443      * System identifier (URI) of external the subset.
0444      */
0445     xmlChar *extSubURI;
0446     /**
0447      * @deprecated Use the `publicId` argument of the
0448      * `internalSubset` SAX callback or #xmlCtxtGetDocTypeDecl
0449      *
0450      * This member is MISNAMED. It contains the *public* identifier
0451      * of the external subset.
0452      */
0453     xmlChar *extSubSystem;
0454 
0455     /* xml:space values */
0456 
0457     /* Should the parser preserve spaces */
0458     int *space XML_DEPRECATED_MEMBER;
0459     /* Depth of the parsing stack */
0460     int spaceNr XML_DEPRECATED_MEMBER;
0461     /* Max depth of the parsing stack */
0462     int spaceMax XML_DEPRECATED_MEMBER;
0463     /* array of space infos */
0464     int *spaceTab XML_DEPRECATED_MEMBER;
0465 
0466     /* to prevent entity substitution loops */
0467     int depth XML_DEPRECATED_MEMBER;
0468     /* unused */
0469     xmlParserInput *entity XML_DEPRECATED_MEMBER;
0470     /* unused */
0471     int charset XML_DEPRECATED_MEMBER;
0472     /* Those two fields are there to speed up large node parsing */
0473     int nodelen XML_DEPRECATED_MEMBER;
0474     int nodemem XML_DEPRECATED_MEMBER;
0475     /**
0476      * @deprecated Use xmlParserOption XML_PARSE_PEDANTIC
0477      *
0478      * signal pedantic warnings
0479      */
0480     int pedantic XML_DEPRECATED_MEMBER;
0481     /**
0482      * @deprecated Use xmlCtxtGetPrivate() and xmlCtxtSetPrivate()
0483      *
0484      * For user data, libxml won't touch it
0485      */
0486     void *_private;
0487     /**
0488      * @deprecated Use xmlParserOption XML_PARSE_DTDLOAD,
0489      * XML_PARSE_DTDATTR or XML_PARSE_SKIP_IDS.
0490      *
0491      * Control loading of the external subset and handling of IDs.
0492      * Other options like `validate` can override this value.
0493      *
0494      * - 0: The default behavior is to process IDs and to ignore
0495      *   the external subset.
0496      * - XML_DETECT_IDS: Load external subset. This flag is
0497      *   misnamed. ID handling is only controlled by XML_SKIP_IDS.
0498      * - XML_COMPLETE_ATTRS: Load external subset and process
0499      *   default attributes.
0500      * - XML_SKIP_IDS: Ignore IDs.
0501      */
0502     int loadsubset XML_DEPRECATED_MEMBER;
0503     /* unused */
0504     int linenumbers XML_DEPRECATED_MEMBER;
0505     /**
0506      * @deprecated Use xmlCtxtGetCatalogs() and xmlCtxtSetCatalogs()
0507      *
0508      * document's own catalog
0509      */
0510     void *catalogs XML_DEPRECATED_MEMBER;
0511     /**
0512      * @deprecated Use xmlParserOption XML_PARSE_RECOVER
0513      * run in recovery mode
0514      */
0515     int recovery XML_DEPRECATED_MEMBER;
0516     /* unused */
0517     int progressive XML_DEPRECATED_MEMBER;
0518     /**
0519      * @deprecated Use xmlCtxtGetDict() and xmlCtxtSetDict()
0520      *
0521      * dictionary for the parser
0522      */
0523     xmlDict *dict;
0524     /* array for the attributes callbacks */
0525     const xmlChar **atts XML_DEPRECATED_MEMBER;
0526     /* the size of the array */
0527     int maxatts XML_DEPRECATED_MEMBER;
0528     /* unused */
0529     int docdict XML_DEPRECATED_MEMBER;
0530 
0531     /*
0532      * pre-interned strings
0533      */
0534     const xmlChar *str_xml XML_DEPRECATED_MEMBER;
0535     const xmlChar *str_xmlns XML_DEPRECATED_MEMBER;
0536     const xmlChar *str_xml_ns XML_DEPRECATED_MEMBER;
0537 
0538     /*
0539      * Everything below is used only by the new SAX mode
0540      */
0541 
0542     /* operating in the new SAX mode */
0543     int sax2 XML_DEPRECATED_MEMBER;
0544     /* the number of inherited namespaces */
0545     int nsNr XML_DEPRECATED_MEMBER;
0546     /* the size of the arrays */
0547     int nsMax XML_DEPRECATED_MEMBER;
0548     /* the array of prefix/namespace name */
0549     const xmlChar **nsTab XML_DEPRECATED_MEMBER;
0550     /* which attribute were allocated */
0551     unsigned *attallocs XML_DEPRECATED_MEMBER;
0552     /* array of data for push */
0553     xmlStartTag *pushTab XML_DEPRECATED_MEMBER;
0554     /* defaulted attributes if any */
0555     xmlHashTable *attsDefault XML_DEPRECATED_MEMBER;
0556     /* non-CDATA attributes if any */
0557     xmlHashTable *attsSpecial XML_DEPRECATED_MEMBER;
0558 
0559     /**
0560      * @deprecated Use xmlCtxtGetStatus()
0561      *
0562      * is the document XML Namespace okay
0563      */
0564     int nsWellFormed;
0565     /**
0566      * @deprecated Use xmlCtxtGetOptions()
0567      *
0568      * Extra options
0569      */
0570     int options;
0571 
0572     /**
0573      * @deprecated Use inverted xmlParserOption XML_PARSE_NODICT
0574      *
0575      * Use dictionary names for the tree
0576      */
0577     int dictNames XML_DEPRECATED_MEMBER;
0578 
0579     /*
0580      * Those fields are needed only for streaming parsing so far
0581      */
0582 
0583     /* number of freed element nodes */
0584     int freeElemsNr XML_DEPRECATED_MEMBER;
0585     /* List of freed element nodes */
0586     xmlNode *freeElems XML_DEPRECATED_MEMBER;
0587     /* number of freed attributes nodes */
0588     int freeAttrsNr XML_DEPRECATED_MEMBER;
0589     /* List of freed attributes nodes */
0590     xmlAttr *freeAttrs XML_DEPRECATED_MEMBER;
0591 
0592     /**
0593      * @deprecated Use xmlCtxtGetLastError()
0594      *
0595      * the complete error information for the last error.
0596      */
0597     xmlError lastError XML_DEPRECATED_MEMBER;
0598     /* the parser mode */
0599     xmlParserMode parseMode XML_DEPRECATED_MEMBER;
0600     /* unused */
0601     unsigned long nbentities XML_DEPRECATED_MEMBER;
0602     /* size of external entities */
0603     unsigned long sizeentities XML_DEPRECATED_MEMBER;
0604 
0605     /* for use by HTML non-recursive parser */
0606     /* Current NodeInfo */
0607     xmlParserNodeInfo *nodeInfo XML_DEPRECATED_MEMBER;
0608     /* Depth of the parsing stack */
0609     int nodeInfoNr XML_DEPRECATED_MEMBER;
0610     /* Max depth of the parsing stack */
0611     int nodeInfoMax XML_DEPRECATED_MEMBER;
0612     /* array of nodeInfos */
0613     xmlParserNodeInfo *nodeInfoTab XML_DEPRECATED_MEMBER;
0614 
0615     /* we need to label inputs */
0616     int input_id XML_DEPRECATED_MEMBER;
0617     /* volume of entity copy */
0618     unsigned long sizeentcopy XML_DEPRECATED_MEMBER;
0619 
0620     /* quote state for push parser */
0621     int endCheckState XML_DEPRECATED_MEMBER;
0622     /* number of errors */
0623     unsigned short nbErrors XML_DEPRECATED_MEMBER;
0624     /* number of warnings */
0625     unsigned short nbWarnings XML_DEPRECATED_MEMBER;
0626     /* maximum amplification factor */
0627     unsigned maxAmpl XML_DEPRECATED_MEMBER;
0628 
0629     /* namespace database */
0630     xmlParserNsData *nsdb XML_DEPRECATED_MEMBER;
0631     /* allocated size */
0632     unsigned attrHashMax XML_DEPRECATED_MEMBER;
0633     /* atttribute hash table */
0634     xmlAttrHashBucket *attrHash XML_DEPRECATED_MEMBER;
0635 
0636     xmlStructuredErrorFunc errorHandler XML_DEPRECATED_MEMBER;
0637     void *errorCtxt XML_DEPRECATED_MEMBER;
0638 
0639     xmlResourceLoader resourceLoader XML_DEPRECATED_MEMBER;
0640     void *resourceCtxt XML_DEPRECATED_MEMBER;
0641 
0642     xmlCharEncConvImpl convImpl XML_DEPRECATED_MEMBER;
0643     void *convCtxt XML_DEPRECATED_MEMBER;
0644 };
0645 
0646 /**
0647  * A SAX Locator.
0648  */
0649 struct _xmlSAXLocator {
0650     const xmlChar *(*getPublicId)(void *ctx);
0651     const xmlChar *(*getSystemId)(void *ctx);
0652     int (*getLineNumber)(void *ctx);
0653     int (*getColumnNumber)(void *ctx);
0654 };
0655 
0656 /**
0657  * SAX callback to resolve external entities.
0658  *
0659  * This is only used to load DTDs. The preferred way to install
0660  * custom resolvers is #xmlCtxtSetResourceLoader.
0661  *
0662  * @param ctx  the user data (XML parser context)
0663  * @param publicId  The public identifier of the entity
0664  * @param systemId  The system identifier of the entity (URL)
0665  * @returns the xmlParserInput if inlined or NULL for DOM behaviour.
0666  */
0667 typedef xmlParserInput *(*resolveEntitySAXFunc) (void *ctx,
0668                 const xmlChar *publicId,
0669                 const xmlChar *systemId);
0670 /**
0671  * SAX callback for the internal subset.
0672  *
0673  * @param ctx  the user data (XML parser context)
0674  * @param name  the root element name
0675  * @param publicId  the public identifier
0676  * @param systemId  the system identifier (e.g. filename or URL)
0677  */
0678 typedef void (*internalSubsetSAXFunc) (void *ctx,
0679                 const xmlChar *name,
0680                 const xmlChar *publicId,
0681                 const xmlChar *systemId);
0682 /**
0683  * SAX callback for the external subset.
0684  *
0685  * @param ctx  the user data (XML parser context)
0686  * @param name  the root element name
0687  * @param publicId  the public identifier
0688  * @param systemId  the system identifier (e.g. filename or URL)
0689  */
0690 typedef void (*externalSubsetSAXFunc) (void *ctx,
0691                 const xmlChar *name,
0692                 const xmlChar *publicId,
0693                 const xmlChar *systemId);
0694 /**
0695  * SAX callback to look up a general entity by name.
0696  *
0697  * @param ctx  the user data (XML parser context)
0698  * @param name  The entity name
0699  * @returns the xmlEntity if found.
0700  */
0701 typedef xmlEntity *(*getEntitySAXFunc) (void *ctx,
0702                 const xmlChar *name);
0703 /**
0704  * SAX callback to look up a parameter entity by name.
0705  *
0706  * @param ctx  the user data (XML parser context)
0707  * @param name  The entity name
0708  * @returns the xmlEntity if found.
0709  */
0710 typedef xmlEntity *(*getParameterEntitySAXFunc) (void *ctx,
0711                 const xmlChar *name);
0712 /**
0713  * SAX callback for entity declarations.
0714  *
0715  * @param ctx  the user data (XML parser context)
0716  * @param name  the entity name
0717  * @param type  the entity type
0718  * @param publicId  The public ID of the entity
0719  * @param systemId  The system ID of the entity
0720  * @param content  the entity value (without processing).
0721  */
0722 typedef void (*entityDeclSAXFunc) (void *ctx,
0723                 const xmlChar *name,
0724                 int type,
0725                 const xmlChar *publicId,
0726                 const xmlChar *systemId,
0727                 xmlChar *content);
0728 /**
0729  * SAX callback for notation declarations.
0730  *
0731  * @param ctx  the user data (XML parser context)
0732  * @param name  The name of the notation
0733  * @param publicId  The public ID of the notation
0734  * @param systemId  The system ID of the notation
0735  */
0736 typedef void (*notationDeclSAXFunc)(void *ctx,
0737                 const xmlChar *name,
0738                 const xmlChar *publicId,
0739                 const xmlChar *systemId);
0740 /**
0741  * SAX callback for attribute declarations.
0742  *
0743  * @param ctx  the user data (XML parser context)
0744  * @param elem  the name of the element
0745  * @param fullname  the attribute name
0746  * @param type  the attribute type
0747  * @param def  the type of default value
0748  * @param defaultValue  the attribute default value
0749  * @param tree  the tree of enumerated value set
0750  */
0751 typedef void (*attributeDeclSAXFunc)(void *ctx,
0752                 const xmlChar *elem,
0753                 const xmlChar *fullname,
0754                 int type,
0755                 int def,
0756                 const xmlChar *defaultValue,
0757                 xmlEnumeration *tree);
0758 /**
0759  * SAX callback for element declarations.
0760  *
0761  * @param ctx  the user data (XML parser context)
0762  * @param name  the element name
0763  * @param type  the element type
0764  * @param content  the element value tree
0765  */
0766 typedef void (*elementDeclSAXFunc)(void *ctx,
0767                 const xmlChar *name,
0768                 int type,
0769                 xmlElementContent *content);
0770 /**
0771  * SAX callback for unparsed entity declarations.
0772  *
0773  * @param ctx  the user data (XML parser context)
0774  * @param name  The name of the entity
0775  * @param publicId  The public ID of the entity
0776  * @param systemId  The system ID of the entity
0777  * @param notationName  the name of the notation
0778  */
0779 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
0780                 const xmlChar *name,
0781                 const xmlChar *publicId,
0782                 const xmlChar *systemId,
0783                 const xmlChar *notationName);
0784 /**
0785  * This callback receives the "document locator" at startup,
0786  * which is always the global xmlDefaultSAXLocator.
0787  *
0788  * Everything is available on the context, so this is useless in
0789  * our case.
0790  *
0791  * @param ctx  the user data (XML parser context)
0792  * @param loc  A SAX Locator
0793  */
0794 typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
0795                 xmlSAXLocator *loc);
0796 /**
0797  * SAX callback for start of document.
0798  *
0799  * @param ctx  the user data (XML parser context)
0800  */
0801 typedef void (*startDocumentSAXFunc) (void *ctx);
0802 /**
0803  * SAX callback for end of document.
0804  *
0805  * @param ctx  the user data (XML parser context)
0806  */
0807 typedef void (*endDocumentSAXFunc) (void *ctx);
0808 /**
0809  * SAX callback for start tags.
0810  *
0811  * @param ctx  the user data (XML parser context)
0812  * @param name  The element name, including namespace prefix
0813  * @param atts  An array of name/value attributes pairs, NULL terminated
0814  */
0815 typedef void (*startElementSAXFunc) (void *ctx,
0816                 const xmlChar *name,
0817                 const xmlChar **atts);
0818 /**
0819  * SAX callback for end tags.
0820  *
0821  * @param ctx  the user data (XML parser context)
0822  * @param name  The element name
0823  */
0824 typedef void (*endElementSAXFunc) (void *ctx,
0825                 const xmlChar *name);
0826 /**
0827  * Callback for attributes.
0828  *
0829  * @deprecated This typedef is unused.
0830  *
0831  * @param ctx  the user data (XML parser context)
0832  * @param name  The attribute name, including namespace prefix
0833  * @param value  The attribute value
0834  */
0835 typedef void (*attributeSAXFunc) (void *ctx,
0836                 const xmlChar *name,
0837                 const xmlChar *value);
0838 /**
0839  * SAX callback for entity references.
0840  *
0841  * @param ctx  the user data (XML parser context)
0842  * @param name  The entity name
0843  */
0844 typedef void (*referenceSAXFunc) (void *ctx,
0845                 const xmlChar *name);
0846 /**
0847  * SAX callback for character data.
0848  *
0849  * @param ctx  the user data (XML parser context)
0850  * @param ch  a xmlChar string
0851  * @param len  the number of xmlChar
0852  */
0853 typedef void (*charactersSAXFunc) (void *ctx,
0854                 const xmlChar *ch,
0855                 int len);
0856 /**
0857  * SAX callback for "ignorable" whitespace.
0858  *
0859  * @param ctx  the user data (XML parser context)
0860  * @param ch  a xmlChar string
0861  * @param len  the number of xmlChar
0862  */
0863 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
0864                 const xmlChar *ch,
0865                 int len);
0866 /**
0867  * SAX callback for processing instructions.
0868  *
0869  * @param ctx  the user data (XML parser context)
0870  * @param target  the target name
0871  * @param data  the PI data's
0872  */
0873 typedef void (*processingInstructionSAXFunc) (void *ctx,
0874                 const xmlChar *target,
0875                 const xmlChar *data);
0876 /**
0877  * SAX callback for comments.
0878  *
0879  * @param ctx  the user data (XML parser context)
0880  * @param value  the comment content
0881  */
0882 typedef void (*commentSAXFunc) (void *ctx,
0883                 const xmlChar *value);
0884 /**
0885  * SAX callback for CDATA sections.
0886  *
0887  * @param ctx  the user data (XML parser context)
0888  * @param value  The pcdata content
0889  * @param len  the block length
0890  */
0891 typedef void (*cdataBlockSAXFunc) (
0892                             void *ctx,
0893                 const xmlChar *value,
0894                 int len);
0895 /**
0896  * SAX callback for warning messages.
0897  *
0898  * @param ctx  an XML parser context
0899  * @param msg  the message to display/transmit
0900  * @param ...  extra parameters for the message display
0901  */
0902 typedef void (*warningSAXFunc) (void *ctx,
0903                 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
0904 /**
0905  * SAX callback for error messages.
0906  *
0907  * @param ctx  an XML parser context
0908  * @param msg  the message to display/transmit
0909  * @param ...  extra parameters for the message display
0910  */
0911 typedef void (*errorSAXFunc) (void *ctx,
0912                 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
0913 /**
0914  * SAX callback for fatal error messages.
0915  *
0916  * @param ctx  an XML parser context
0917  * @param msg  the message to display/transmit
0918  * @param ...  extra parameters for the message display
0919  */
0920 typedef void (*fatalErrorSAXFunc) (void *ctx,
0921                 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
0922 /**
0923  * SAX callback to get standalone status.
0924  *
0925  * @param ctx  the user data (XML parser context)
0926  * @returns 1 if true
0927  */
0928 typedef int (*isStandaloneSAXFunc) (void *ctx);
0929 /**
0930  * SAX callback to get internal subset status.
0931  *
0932  * @param ctx  the user data (XML parser context)
0933  * @returns 1 if true
0934  */
0935 typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
0936 
0937 /**
0938  * SAX callback to get external subset status.
0939  *
0940  * @param ctx  the user data (XML parser context)
0941  * @returns 1 if true
0942  */
0943 typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
0944 
0945 /************************************************************************
0946  *                                  *
0947  *          The SAX version 2 API extensions        *
0948  *                                  *
0949  ************************************************************************/
0950 /**
0951  * Special constant required for SAX2 handlers.
0952  */
0953 #define XML_SAX2_MAGIC 0xDEEDBEAF
0954 
0955 /**
0956  * SAX2 callback for start tags.
0957  *
0958  * It provides the namespace information for the element, as well as
0959  * the new namespace declarations on the element.
0960  *
0961  * @param ctx  the user data (XML parser context)
0962  * @param localname  the local name of the element
0963  * @param prefix  the element namespace prefix if available
0964  * @param URI  the element namespace name if available
0965  * @param nb_namespaces  number of namespace definitions on that node
0966  * @param namespaces  pointer to the array of prefix/URI pairs namespace definitions
0967  * @param nb_attributes  the number of attributes on that node
0968  * @param nb_defaulted  the number of defaulted attributes. The defaulted
0969  *                  ones are at the end of the array
0970  * @param attributes  pointer to the array of (localname/prefix/URI/value/end)
0971  *               attribute values.
0972  */
0973 
0974 typedef void (*startElementNsSAX2Func) (void *ctx,
0975                     const xmlChar *localname,
0976                     const xmlChar *prefix,
0977                     const xmlChar *URI,
0978                     int nb_namespaces,
0979                     const xmlChar **namespaces,
0980                     int nb_attributes,
0981                     int nb_defaulted,
0982                     const xmlChar **attributes);
0983 
0984 /**
0985  * SAX2 callback for end tags.
0986  *
0987  * It provides the namespace information for the element.
0988  *
0989  * @param ctx  the user data (XML parser context)
0990  * @param localname  the local name of the element
0991  * @param prefix  the element namespace prefix if available
0992  * @param URI  the element namespace name if available
0993  */
0994 
0995 typedef void (*endElementNsSAX2Func)   (void *ctx,
0996                     const xmlChar *localname,
0997                     const xmlChar *prefix,
0998                     const xmlChar *URI);
0999 
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  */
1007 struct _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  */
1197 typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
1198 typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
1199 /**
1200  * SAX handler, version 1.
1201  *
1202  * @deprecated Use version 2 handlers.
1203  */
1204 struct _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  */
1247 typedef xmlParserInput *(*xmlExternalEntityLoader) (const char *URL,
1248                      const char *publicId,
1249                      xmlParserCtxt *context);
1250 
1251 /*
1252  * Variables
1253  */
1254 
1255 XMLPUBVAR const char *const xmlParserVersion;
1256 
1257 /** @cond ignore */
1258 
1259 XML_DEPRECATED
1260 XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator;
1261 #ifdef LIBXML_SAX1_ENABLED
1262 /**
1263  * @deprecated Use #xmlSAXVersion or #xmlSAX2InitDefaultSAXHandler
1264  */
1265 XML_DEPRECATED
1266 XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler;
1267 #endif
1268 
1269 XML_DEPRECATED
1270 XMLPUBFUN int *__xmlDoValidityCheckingDefaultValue(void);
1271 XML_DEPRECATED
1272 XMLPUBFUN int *__xmlGetWarningsDefaultValue(void);
1273 XML_DEPRECATED
1274 XMLPUBFUN int *__xmlKeepBlanksDefaultValue(void);
1275 XML_DEPRECATED
1276 XMLPUBFUN int *__xmlLineNumbersDefaultValue(void);
1277 XML_DEPRECATED
1278 XMLPUBFUN int *__xmlLoadExtDtdDefaultValue(void);
1279 XML_DEPRECATED
1280 XMLPUBFUN int *__xmlPedanticParserDefaultValue(void);
1281 XML_DEPRECATED
1282 XMLPUBFUN int *__xmlSubstituteEntitiesDefaultValue(void);
1283 
1284 #ifdef LIBXML_OUTPUT_ENABLED
1285 XML_DEPRECATED
1286 XMLPUBFUN int *__xmlIndentTreeOutput(void);
1287 XML_DEPRECATED
1288 XMLPUBFUN const char **__xmlTreeIndentString(void);
1289 XML_DEPRECATED
1290 XMLPUBFUN 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  */
1379 XMLPUBFUN void
1380         xmlInitParser       (void);
1381 XMLPUBFUN void
1382         xmlCleanupParser    (void);
1383 XML_DEPRECATED
1384 XMLPUBFUN void
1385         xmlInitGlobals      (void);
1386 XML_DEPRECATED
1387 XMLPUBFUN void
1388         xmlCleanupGlobals   (void);
1389 
1390 /*
1391  * Input functions
1392  */
1393 XML_DEPRECATED
1394 XMLPUBFUN int
1395         xmlParserInputRead  (xmlParserInput *in,
1396                      int len);
1397 XMLPUBFUN int
1398         xmlParserInputGrow  (xmlParserInput *in,
1399                      int len);
1400 
1401 /*
1402  * Basic parsing Interfaces
1403  */
1404 #ifdef LIBXML_SAX1_ENABLED
1405 XMLPUBFUN xmlDoc *
1406         xmlParseDoc     (const xmlChar *cur);
1407 XMLPUBFUN xmlDoc *
1408         xmlParseFile        (const char *filename);
1409 XMLPUBFUN xmlDoc *
1410         xmlParseMemory      (const char *buffer,
1411                      int size);
1412 #endif /* LIBXML_SAX1_ENABLED */
1413 XML_DEPRECATED
1414 XMLPUBFUN int
1415         xmlSubstituteEntitiesDefault(int val);
1416 XMLPUBFUN int
1417         xmlKeepBlanksDefault    (int val);
1418 XMLPUBFUN void
1419         xmlStopParser       (xmlParserCtxt *ctxt);
1420 XML_DEPRECATED
1421 XMLPUBFUN int
1422         xmlPedanticParserDefault(int val);
1423 XML_DEPRECATED
1424 XMLPUBFUN int
1425         xmlLineNumbersDefault   (int val);
1426 
1427 XML_DEPRECATED
1428 XMLPUBFUN int
1429                 xmlThrDefSubstituteEntitiesDefaultValue(int v);
1430 XML_DEPRECATED
1431 XMLPUBFUN int
1432         xmlThrDefKeepBlanksDefaultValue(int v);
1433 XML_DEPRECATED
1434 XMLPUBFUN int
1435                 xmlThrDefPedanticParserDefaultValue(int v);
1436 XML_DEPRECATED
1437 XMLPUBFUN int
1438                 xmlThrDefLineNumbersDefaultValue(int v);
1439 XML_DEPRECATED
1440 XMLPUBFUN int
1441                 xmlThrDefDoValidityCheckingDefaultValue(int v);
1442 XML_DEPRECATED
1443 XMLPUBFUN int
1444                 xmlThrDefGetWarningsDefaultValue(int v);
1445 XML_DEPRECATED
1446 XMLPUBFUN int
1447                 xmlThrDefLoadExtDtdDefaultValue(int v);
1448 
1449 #ifdef LIBXML_SAX1_ENABLED
1450 /*
1451  * Recovery mode
1452  */
1453 XML_DEPRECATED
1454 XMLPUBFUN xmlDoc *
1455         xmlRecoverDoc       (const xmlChar *cur);
1456 XML_DEPRECATED
1457 XMLPUBFUN xmlDoc *
1458         xmlRecoverMemory    (const char *buffer,
1459                      int size);
1460 XML_DEPRECATED
1461 XMLPUBFUN xmlDoc *
1462         xmlRecoverFile      (const char *filename);
1463 #endif /* LIBXML_SAX1_ENABLED */
1464 
1465 /*
1466  * Less common routines and SAX interfaces
1467  */
1468 XMLPUBFUN int
1469         xmlParseDocument    (xmlParserCtxt *ctxt);
1470 XML_DEPRECATED
1471 XMLPUBFUN int
1472         xmlParseExtParsedEnt    (xmlParserCtxt *ctxt);
1473 #ifdef LIBXML_SAX1_ENABLED
1474 XML_DEPRECATED
1475 XMLPUBFUN int
1476         xmlSAXUserParseFile (xmlSAXHandler *sax,
1477                      void *user_data,
1478                      const char *filename);
1479 XML_DEPRECATED
1480 XMLPUBFUN int
1481         xmlSAXUserParseMemory   (xmlSAXHandler *sax,
1482                      void *user_data,
1483                      const char *buffer,
1484                      int size);
1485 XML_DEPRECATED
1486 XMLPUBFUN xmlDoc *
1487         xmlSAXParseDoc      (xmlSAXHandler *sax,
1488                      const xmlChar *cur,
1489                      int recovery);
1490 XML_DEPRECATED
1491 XMLPUBFUN xmlDoc *
1492         xmlSAXParseMemory   (xmlSAXHandler *sax,
1493                      const char *buffer,
1494                      int size,
1495                      int recovery);
1496 XML_DEPRECATED
1497 XMLPUBFUN xmlDoc *
1498         xmlSAXParseMemoryWithData (xmlSAXHandler *sax,
1499                      const char *buffer,
1500                      int size,
1501                      int recovery,
1502                      void *data);
1503 XML_DEPRECATED
1504 XMLPUBFUN xmlDoc *
1505         xmlSAXParseFile     (xmlSAXHandler *sax,
1506                      const char *filename,
1507                      int recovery);
1508 XML_DEPRECATED
1509 XMLPUBFUN xmlDoc *
1510         xmlSAXParseFileWithData (xmlSAXHandler *sax,
1511                      const char *filename,
1512                      int recovery,
1513                      void *data);
1514 XML_DEPRECATED
1515 XMLPUBFUN xmlDoc *
1516         xmlSAXParseEntity   (xmlSAXHandler *sax,
1517                      const char *filename);
1518 XML_DEPRECATED
1519 XMLPUBFUN xmlDoc *
1520         xmlParseEntity      (const char *filename);
1521 #endif /* LIBXML_SAX1_ENABLED */
1522 
1523 #ifdef LIBXML_VALID_ENABLED
1524 XMLPUBFUN xmlDtd *
1525         xmlCtxtParseDtd     (xmlParserCtxt *ctxt,
1526                      xmlParserInput *input,
1527                      const xmlChar *publicId,
1528                      const xmlChar *systemId);
1529 XMLPUBFUN int
1530         xmlCtxtValidateDocument (xmlParserCtxt *ctxt,
1531                      xmlDoc *doc);
1532 XMLPUBFUN int
1533         xmlCtxtValidateDtd  (xmlParserCtxt *ctxt,
1534                      xmlDoc *doc,
1535                      xmlDtd *dtd);
1536 XML_DEPRECATED
1537 XMLPUBFUN xmlDtd *
1538         xmlSAXParseDTD      (xmlSAXHandler *sax,
1539                      const xmlChar *publicId,
1540                      const xmlChar *systemId);
1541 XMLPUBFUN xmlDtd *
1542         xmlParseDTD     (const xmlChar *publicId,
1543                      const xmlChar *systemId);
1544 XMLPUBFUN xmlDtd *
1545         xmlIOParseDTD       (xmlSAXHandler *sax,
1546                      xmlParserInputBuffer *input,
1547                      xmlCharEncoding enc);
1548 #endif /* LIBXML_VALID_ENABLE */
1549 #ifdef LIBXML_SAX1_ENABLED
1550 XMLPUBFUN 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 */
1558 XMLPUBFUN xmlParserErrors
1559         xmlParseInNodeContext   (xmlNode *node,
1560                      const char *data,
1561                      int datalen,
1562                      int options,
1563                      xmlNode **lst);
1564 #ifdef LIBXML_SAX1_ENABLED
1565 XMLPUBFUN 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);
1573 XML_DEPRECATED
1574 XMLPUBFUN 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 */
1583 XMLPUBFUN int
1584         xmlParseCtxtExternalEntity(xmlParserCtxt *ctx,
1585                      const xmlChar *URL,
1586                      const xmlChar *ID,
1587                      xmlNode **lst);
1588 
1589 /*
1590  * Parser contexts handling.
1591  */
1592 XMLPUBFUN xmlParserCtxt *
1593         xmlNewParserCtxt    (void);
1594 XMLPUBFUN xmlParserCtxt *
1595         xmlNewSAXParserCtxt (const xmlSAXHandler *sax,
1596                      void *userData);
1597 XMLPUBFUN int
1598         xmlInitParserCtxt   (xmlParserCtxt *ctxt);
1599 XML_DEPRECATED
1600 XMLPUBFUN void
1601         xmlClearParserCtxt  (xmlParserCtxt *ctxt);
1602 XMLPUBFUN void
1603         xmlFreeParserCtxt   (xmlParserCtxt *ctxt);
1604 #ifdef LIBXML_SAX1_ENABLED
1605 XML_DEPRECATED
1606 XMLPUBFUN void
1607         xmlSetupParserForBuffer (xmlParserCtxt *ctxt,
1608                      const xmlChar* buffer,
1609                      const char *filename);
1610 #endif /* LIBXML_SAX1_ENABLED */
1611 XMLPUBFUN xmlParserCtxt *
1612         xmlCreateDocParserCtxt  (const xmlChar *cur);
1613 
1614 #ifdef LIBXML_PUSH_ENABLED
1615 /*
1616  * Interfaces for the Push mode.
1617  */
1618 XMLPUBFUN xmlParserCtxt *
1619         xmlCreatePushParserCtxt(xmlSAXHandler *sax,
1620                      void *user_data,
1621                      const char *chunk,
1622                      int size,
1623                      const char *filename);
1624 XMLPUBFUN 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 
1635 XMLPUBFUN xmlParserCtxt *
1636         xmlCreateIOParserCtxt   (xmlSAXHandler *sax,
1637                      void *user_data,
1638                      xmlInputReadCallback   ioread,
1639                      xmlInputCloseCallback  ioclose,
1640                      void *ioctx,
1641                      xmlCharEncoding enc);
1642 
1643 XMLPUBFUN xmlParserInput *
1644         xmlNewIOInputStream (xmlParserCtxt *ctxt,
1645                      xmlParserInputBuffer *input,
1646                      xmlCharEncoding enc);
1647 
1648 /*
1649  * Node infos.
1650  */
1651 XML_DEPRECATED
1652 XMLPUBFUN const xmlParserNodeInfo*
1653         xmlParserFindNodeInfo   (xmlParserCtxt *ctxt,
1654                          xmlNode *node);
1655 XML_DEPRECATED
1656 XMLPUBFUN void
1657         xmlInitNodeInfoSeq  (xmlParserNodeInfoSeq *seq);
1658 XML_DEPRECATED
1659 XMLPUBFUN void
1660         xmlClearNodeInfoSeq (xmlParserNodeInfoSeq *seq);
1661 XML_DEPRECATED
1662 XMLPUBFUN unsigned long
1663         xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeq *seq,
1664                                          xmlNode *node);
1665 XML_DEPRECATED
1666 XMLPUBFUN void
1667         xmlParserAddNodeInfo    (xmlParserCtxt *ctxt,
1668                      xmlParserNodeInfo *info);
1669 
1670 /*
1671  * External entities handling actually implemented in xmlIO.
1672  */
1673 
1674 XMLPUBFUN void
1675         xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1676 XMLPUBFUN xmlExternalEntityLoader
1677         xmlGetExternalEntityLoader(void);
1678 XMLPUBFUN xmlParserInput *
1679         xmlLoadExternalEntity   (const char *URL,
1680                      const char *ID,
1681                      xmlParserCtxt *ctxt);
1682 
1683 XML_DEPRECATED
1684 XMLPUBFUN 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  */
1695 typedef 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 
1890 XMLPUBFUN void
1891         xmlCtxtReset        (xmlParserCtxt *ctxt);
1892 XMLPUBFUN int
1893         xmlCtxtResetPush    (xmlParserCtxt *ctxt,
1894                      const char *chunk,
1895                      int size,
1896                      const char *filename,
1897                      const char *encoding);
1898 XMLPUBFUN int
1899         xmlCtxtGetOptions   (xmlParserCtxt *ctxt);
1900 XMLPUBFUN int
1901         xmlCtxtSetOptions   (xmlParserCtxt *ctxt,
1902                      int options);
1903 XMLPUBFUN int
1904         xmlCtxtUseOptions   (xmlParserCtxt *ctxt,
1905                      int options);
1906 XMLPUBFUN void *
1907         xmlCtxtGetPrivate   (xmlParserCtxt *ctxt);
1908 XMLPUBFUN void
1909         xmlCtxtSetPrivate   (xmlParserCtxt *ctxt,
1910                      void *priv);
1911 XMLPUBFUN void *
1912         xmlCtxtGetCatalogs  (xmlParserCtxt *ctxt);
1913 XMLPUBFUN void
1914         xmlCtxtSetCatalogs  (xmlParserCtxt *ctxt,
1915                      void *catalogs);
1916 XMLPUBFUN xmlDict *
1917         xmlCtxtGetDict      (xmlParserCtxt *ctxt);
1918 XMLPUBFUN void
1919         xmlCtxtSetDict      (xmlParserCtxt *ctxt,
1920                      xmlDict *);
1921 XMLPUBFUN xmlSAXHandler *
1922         xmlCtxtGetSaxHandler    (xmlParserCtxt *ctxt);
1923 XMLPUBFUN int
1924         xmlCtxtSetSaxHandler    (xmlParserCtxt *ctxt,
1925                      const xmlSAXHandler *sax);
1926 XMLPUBFUN xmlDoc *
1927         xmlCtxtGetDocument  (xmlParserCtxt *ctxt);
1928 XMLPUBFUN int
1929         xmlCtxtIsHtml       (xmlParserCtxt *ctxt);
1930 XMLPUBFUN int
1931         xmlCtxtIsStopped    (xmlParserCtxt *ctxt);
1932 XMLPUBFUN int
1933         xmlCtxtIsInSubset   (xmlParserCtxt *ctxt);
1934 #ifdef LIBXML_VALID_ENABLED
1935 XMLPUBFUN xmlValidCtxt *
1936         xmlCtxtGetValidCtxt (xmlParserCtxt *ctxt);
1937 #endif
1938 XMLPUBFUN const xmlChar *
1939         xmlCtxtGetVersion   (xmlParserCtxt *ctxt);
1940 XMLPUBFUN const xmlChar *
1941         xmlCtxtGetDeclaredEncoding(xmlParserCtxt *ctxt);
1942 XMLPUBFUN int
1943         xmlCtxtGetStandalone    (xmlParserCtxt *ctxt);
1944 XMLPUBFUN xmlParserStatus
1945         xmlCtxtGetStatus    (xmlParserCtxt *ctxt);
1946 XMLPUBFUN void *
1947         xmlCtxtGetUserData  (xmlParserCtxt *ctxt);
1948 XMLPUBFUN xmlNode *
1949         xmlCtxtGetNode      (xmlParserCtxt *ctxt);
1950 XMLPUBFUN int
1951         xmlCtxtGetDocTypeDecl   (xmlParserCtxt *ctxt,
1952                      const xmlChar **name,
1953                      const xmlChar **systemId,
1954                      const xmlChar **publicId);
1955 XMLPUBFUN int
1956         xmlCtxtGetInputPosition (xmlParserCtxt *ctxt,
1957                      int inputIndex,
1958                      const char **filname,
1959                      int *line,
1960                      int *col,
1961                      unsigned long *bytePos);
1962 XMLPUBFUN int
1963         xmlCtxtGetInputWindow   (xmlParserCtxt *ctxt,
1964                      int inputIndex,
1965                      const xmlChar **startOut,
1966                      int *sizeInOut,
1967                      int *offsetOut);
1968 XMLPUBFUN void
1969         xmlCtxtSetErrorHandler  (xmlParserCtxt *ctxt,
1970                      xmlStructuredErrorFunc handler,
1971                      void *data);
1972 XMLPUBFUN void
1973         xmlCtxtSetResourceLoader(xmlParserCtxt *ctxt,
1974                      xmlResourceLoader loader,
1975                      void *vctxt);
1976 XMLPUBFUN void
1977         xmlCtxtSetCharEncConvImpl(xmlParserCtxt *ctxt,
1978                      xmlCharEncConvImpl impl,
1979                      void *vctxt);
1980 XMLPUBFUN void
1981         xmlCtxtSetMaxAmplification(xmlParserCtxt *ctxt,
1982                      unsigned maxAmpl);
1983 XMLPUBFUN xmlDoc *
1984         xmlReadDoc      (const xmlChar *cur,
1985                      const char *URL,
1986                      const char *encoding,
1987                      int options);
1988 XMLPUBFUN xmlDoc *
1989         xmlReadFile     (const char *URL,
1990                      const char *encoding,
1991                      int options);
1992 XMLPUBFUN xmlDoc *
1993         xmlReadMemory       (const char *buffer,
1994                      int size,
1995                      const char *URL,
1996                      const char *encoding,
1997                      int options);
1998 XMLPUBFUN xmlDoc *
1999         xmlReadFd       (int fd,
2000                      const char *URL,
2001                      const char *encoding,
2002                      int options);
2003 XMLPUBFUN xmlDoc *
2004         xmlReadIO       (xmlInputReadCallback ioread,
2005                      xmlInputCloseCallback ioclose,
2006                      void *ioctx,
2007                      const char *URL,
2008                      const char *encoding,
2009                      int options);
2010 XMLPUBFUN xmlDoc *
2011         xmlCtxtParseDocument    (xmlParserCtxt *ctxt,
2012                      xmlParserInput *input);
2013 XMLPUBFUN xmlNode *
2014         xmlCtxtParseContent (xmlParserCtxt *ctxt,
2015                      xmlParserInput *input,
2016                      xmlNode *node,
2017                      int hasTextDecl);
2018 XMLPUBFUN xmlDoc *
2019         xmlCtxtReadDoc      (xmlParserCtxt *ctxt,
2020                      const xmlChar *cur,
2021                      const char *URL,
2022                      const char *encoding,
2023                      int options);
2024 XMLPUBFUN xmlDoc *
2025         xmlCtxtReadFile     (xmlParserCtxt *ctxt,
2026                      const char *filename,
2027                      const char *encoding,
2028                      int options);
2029 XMLPUBFUN xmlDoc *
2030         xmlCtxtReadMemory       (xmlParserCtxt *ctxt,
2031                      const char *buffer,
2032                      int size,
2033                      const char *URL,
2034                      const char *encoding,
2035                      int options);
2036 XMLPUBFUN xmlDoc *
2037         xmlCtxtReadFd       (xmlParserCtxt *ctxt,
2038                      int fd,
2039                      const char *URL,
2040                      const char *encoding,
2041                      int options);
2042 XMLPUBFUN 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 
2055 XMLPUBFUN xmlParserErrors
2056 xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags,
2057                    xmlParserInput **out);
2058 XMLPUBFUN xmlParserInput *
2059 xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
2060                       xmlParserInputFlags flags);
2061 XMLPUBFUN xmlParserInput *
2062 xmlNewInputFromString(const char *url, const char *str,
2063                       xmlParserInputFlags flags);
2064 XMLPUBFUN xmlParserInput *
2065 xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags);
2066 XMLPUBFUN xmlParserInput *
2067 xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
2068                   xmlInputCloseCallback ioClose, void *ioCtxt,
2069                   xmlParserInputFlags flags);
2070 XMLPUBFUN xmlParserErrors
2071 xmlInputSetEncodingHandler(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  */
2083 typedef 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 
2155 XMLPUBFUN int
2156         xmlHasFeature       (xmlFeature feature);
2157 
2158 #ifdef __cplusplus
2159 }
2160 #endif
2161 #endif /* __XML_PARSER_H__ */