set eol-style:native
[reactos.git] / reactos / lib / libxml2 / include / libxml / parser.h
index 8a1075d..7203ca3 100644 (file)
-/*\r
- * Summary: the core parser module\r
- * Description: Interfaces, constants and types related to the XML parser\r
- *\r
- * Copy: See Copyright for the status of this software.\r
- *\r
- * Author: Daniel Veillard\r
- */\r
-\r
-#ifndef __XML_PARSER_H__\r
-#define __XML_PARSER_H__\r
-\r
-#include <stdarg.h>\r
-\r
-#include <libxml/xmlversion.h>\r
-#include <libxml/tree.h>\r
-#include <libxml/dict.h>\r
-#include <libxml/hash.h>\r
-#include <libxml/valid.h>\r
-#include <libxml/entities.h>\r
-#include <libxml/xmlerror.h>\r
-#include <libxml/xmlstring.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/**\r
- * XML_DEFAULT_VERSION:\r
- *\r
- * The default version of XML used: 1.0\r
- */\r
-#define XML_DEFAULT_VERSION    "1.0"\r
-\r
-/**\r
- * xmlParserInput:\r
- *\r
- * An xmlParserInput is an input flow for the XML processor.\r
- * Each entity parsed is associated an xmlParserInput (except the\r
- * few predefined ones). This is the case both for internal entities\r
- * - in which case the flow is already completely in memory - or\r
- * external entities - in which case we use the buf structure for\r
- * progressive reading and I18N conversions to the internal UTF-8 format.\r
- */\r
-\r
-/**\r
- * xmlParserInputDeallocate:\r
- * @str:  the string to deallocate\r
- *\r
- * Callback for freeing some parser input allocations.\r
- */\r
-typedef void (* xmlParserInputDeallocate)(xmlChar *str);\r
-\r
-struct _xmlParserInput {\r
-    /* Input buffer */\r
-    xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */\r
-\r
-    const char *filename;             /* The file analyzed, if any */\r
-    const char *directory;            /* the directory/base of the file */\r
-    const xmlChar *base;              /* Base of the array to parse */\r
-    const xmlChar *cur;               /* Current char being parsed */\r
-    const xmlChar *end;               /* end of the array to parse */\r
-    int length;                       /* length if known */\r
-    int line;                         /* Current line */\r
-    int col;                          /* Current column */\r
-    /*\r
-     * NOTE: consumed is only tested for equality in the parser code,\r
-     *       so even if there is an overflow this should not give troubles\r
-     *       for parsing very large instances.\r
-     */\r
-    unsigned long consumed;           /* How many xmlChars already consumed */\r
-    xmlParserInputDeallocate free;    /* function to deallocate the base */\r
-    const xmlChar *encoding;          /* the encoding string for entity */\r
-    const xmlChar *version;           /* the version string for entity */\r
-    int standalone;                   /* Was that entity marked standalone */\r
-    int id;                           /* an unique identifier for the entity */\r
-};\r
-\r
-/**\r
- * xmlParserNodeInfo:\r
- *\r
- * The parser can be asked to collect Node informations, i.e. at what\r
- * place in the file they were detected. \r
- * NOTE: This is off by default and not very well tested.\r
- */\r
-typedef struct _xmlParserNodeInfo xmlParserNodeInfo;\r
-typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;\r
-\r
-struct _xmlParserNodeInfo {\r
-  const struct _xmlNode* node;\r
-  /* Position & line # that text that created the node begins & ends on */\r
-  unsigned long begin_pos;\r
-  unsigned long begin_line;\r
-  unsigned long end_pos;\r
-  unsigned long end_line;\r
-};\r
-\r
-typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;\r
-typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;\r
-struct _xmlParserNodeInfoSeq {\r
-  unsigned long maximum;\r
-  unsigned long length;\r
-  xmlParserNodeInfo* buffer;\r
-};\r
-\r
-/**\r
- * xmlParserInputState:\r
- *\r
- * The parser is now working also as a state based parser.\r
- * The recursive one use the state info for entities processing.\r
- */\r
-typedef enum {\r
-    XML_PARSER_EOF = -1,       /* nothing is to be parsed */\r
-    XML_PARSER_START = 0,      /* nothing has been parsed */\r
-    XML_PARSER_MISC,           /* Misc* before int subset */\r
-    XML_PARSER_PI,             /* Within a processing instruction */\r
-    XML_PARSER_DTD,            /* within some DTD content */\r
-    XML_PARSER_PROLOG,         /* Misc* after internal subset */\r
-    XML_PARSER_COMMENT,                /* within a comment */\r
-    XML_PARSER_START_TAG,      /* within a start tag */\r
-    XML_PARSER_CONTENT,                /* within the content */\r
-    XML_PARSER_CDATA_SECTION,  /* within a CDATA section */\r
-    XML_PARSER_END_TAG,                /* within a closing tag */\r
-    XML_PARSER_ENTITY_DECL,    /* within an entity declaration */\r
-    XML_PARSER_ENTITY_VALUE,   /* within an entity value in a decl */\r
-    XML_PARSER_ATTRIBUTE_VALUE,        /* within an attribute value */\r
-    XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */\r
-    XML_PARSER_EPILOG,                 /* the Misc* after the last end tag */\r
-    XML_PARSER_IGNORE,         /* within an IGNORED section */\r
-    XML_PARSER_PUBLIC_LITERAL  /* within a PUBLIC value */\r
-} xmlParserInputState;\r
-\r
-/**\r
- * XML_DETECT_IDS:\r
- *\r
- * Bit in the loadsubset context field to tell to do ID/REFs lookups.\r
- * Use it to initialize xmlLoadExtDtdDefaultValue.\r
- */\r
-#define XML_DETECT_IDS         2\r
-\r
-/**\r
- * XML_COMPLETE_ATTRS:\r
- *\r
- * Bit in the loadsubset context field to tell to do complete the\r
- * elements attributes lists with the ones defaulted from the DTDs.\r
- * Use it to initialize xmlLoadExtDtdDefaultValue.\r
- */\r
-#define XML_COMPLETE_ATTRS     4\r
-\r
-/**\r
- * XML_SKIP_IDS:\r
- *\r
- * Bit in the loadsubset context field to tell to not do ID/REFs registration.\r
- * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.\r
- */\r
-#define XML_SKIP_IDS           8\r
-\r
-/**\r
- * xmlParserMode:\r
- *\r
- * A parser can operate in various modes\r
- */\r
-typedef enum {\r
-    XML_PARSE_UNKNOWN = 0,\r
-    XML_PARSE_DOM = 1,\r
-    XML_PARSE_SAX = 2,\r
-    XML_PARSE_PUSH_DOM = 3,\r
-    XML_PARSE_PUSH_SAX = 4,\r
-    XML_PARSE_READER = 5\r
-} xmlParserMode;\r
-\r
-/**\r
- * xmlParserCtxt:\r
- *\r
- * The parser context.\r
- * NOTE This doesn't completely define the parser state, the (current ?)\r
- *      design of the parser uses recursive function calls since this allow\r
- *      and easy mapping from the production rules of the specification\r
- *      to the actual code. The drawback is that the actual function call\r
- *      also reflect the parser state. However most of the parsing routines\r
- *      takes as the only argument the parser context pointer, so migrating\r
- *      to a state based parser for progressive parsing shouldn't be too hard.\r
- */\r
-struct _xmlParserCtxt {\r
-    struct _xmlSAXHandler *sax;       /* The SAX handler */\r
-    void            *userData;        /* For SAX interface only, used by DOM build */\r
-    xmlDocPtr           myDoc;        /* the document being built */\r
-    int            wellFormed;        /* is the document well formed */\r
-    int       replaceEntities;        /* shall we replace entities ? */\r
-    const xmlChar    *version;        /* the XML version string */\r
-    const xmlChar   *encoding;        /* the declared encoding, if any */\r
-    int            standalone;        /* standalone document */\r
-    int                  html;        /* an HTML(1)/Docbook(2) document */\r
-\r
-    /* Input stream stack */\r
-    xmlParserInputPtr  input;         /* Current input stream */\r
-    int                inputNr;       /* Number of current input streams */\r
-    int                inputMax;      /* Max number of input streams */\r
-    xmlParserInputPtr *inputTab;      /* stack of inputs */\r
-\r
-    /* Node analysis stack only used for DOM building */\r
-    xmlNodePtr         node;          /* Current parsed Node */\r
-    int                nodeNr;        /* Depth of the parsing stack */\r
-    int                nodeMax;       /* Max depth of the parsing stack */\r
-    xmlNodePtr        *nodeTab;       /* array of nodes */\r
-\r
-    int record_info;                  /* Whether node info should be kept */\r
-    xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */\r
-\r
-    int errNo;                        /* error code */\r
-\r
-    int     hasExternalSubset;        /* reference and external subset */\r
-    int             hasPErefs;        /* the internal subset has PE refs */\r
-    int              external;        /* are we parsing an external entity */\r
-\r
-    int                 valid;        /* is the document valid */\r
-    int              validate;        /* shall we try to validate ? */\r
-    xmlValidCtxt        vctxt;        /* The validity context */\r
-\r
-    xmlParserInputState instate;      /* current type of input */\r
-    int                 token;        /* next char look-ahead */    \r
-\r
-    char           *directory;        /* the data directory */\r
-\r
-    /* Node name stack */\r
-    const xmlChar     *name;          /* Current parsed Node */\r
-    int                nameNr;        /* Depth of the parsing stack */\r
-    int                nameMax;       /* Max depth of the parsing stack */\r
-    const xmlChar *   *nameTab;       /* array of nodes */\r
-\r
-    long               nbChars;       /* number of xmlChar processed */\r
-    long            checkIndex;       /* used by progressive parsing lookup */\r
-    int             keepBlanks;       /* ugly but ... */\r
-    int             disableSAX;       /* SAX callbacks are disabled */\r
-    int               inSubset;       /* Parsing is in int 1/ext 2 subset */\r
-    const xmlChar *    intSubName;    /* name of subset */\r
-    xmlChar *          extSubURI;     /* URI of external subset */\r
-    xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */\r
-\r
-    /* xml:space values */\r
-    int *              space;         /* Should the parser preserve spaces */\r
-    int                spaceNr;       /* Depth of the parsing stack */\r
-    int                spaceMax;      /* Max depth of the parsing stack */\r
-    int *              spaceTab;      /* array of space infos */\r
-\r
-    int                depth;         /* to prevent entity substitution loops */\r
-    xmlParserInputPtr  entity;        /* used to check entities boundaries */\r
-    int                charset;       /* encoding of the in-memory content\r
-                                        actually an xmlCharEncoding */\r
-    int                nodelen;       /* Those two fields are there to */\r
-    int                nodemem;       /* Speed up large node parsing */\r
-    int                pedantic;      /* signal pedantic warnings */\r
-    void              *_private;      /* For user data, libxml won't touch it */\r
-\r
-    int                loadsubset;    /* should the external subset be loaded */\r
-    int                linenumbers;   /* set line number in element content */\r
-    void              *catalogs;      /* document's own catalog */\r
-    int                recovery;      /* run in recovery mode */\r
-    int                progressive;   /* is this a progressive parsing */\r
-    xmlDictPtr         dict;          /* dictionnary for the parser */\r
-    const xmlChar *   *atts;          /* array for the attributes callbacks */\r
-    int                maxatts;       /* the size of the array */\r
-    int                docdict;       /* use strings from dict to build tree */\r
-\r
-    /*\r
-     * pre-interned strings\r
-     */\r
-    const xmlChar *str_xml;\r
-    const xmlChar *str_xmlns;\r
-    const xmlChar *str_xml_ns;\r
-\r
-    /*\r
-     * Everything below is used only by the new SAX mode\r
-     */\r
-    int                sax2;          /* operating in the new SAX mode */\r
-    int                nsNr;          /* the number of inherited namespaces */\r
-    int                nsMax;         /* the size of the arrays */\r
-    const xmlChar *   *nsTab;         /* the array of prefix/namespace name */\r
-    int               *attallocs;     /* which attribute were allocated */\r
-    void *            *pushTab;       /* array of data for push */\r
-    xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */\r
-    xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */\r
-    int                nsWellFormed;  /* is the document XML Nanespace okay */\r
-    int                options;       /* Extra options */\r
-\r
-    /*\r
-     * Those fields are needed only for treaming parsing so far\r
-     */\r
-    int               dictNames;    /* Use dictionary names for the tree */\r
-    int               freeElemsNr;  /* number of freed element nodes */\r
-    xmlNodePtr        freeElems;    /* List of freed element nodes */\r
-    int               freeAttrsNr;  /* number of freed attributes nodes */\r
-    xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */\r
-\r
-    /*\r
-     * the complete error informations for the last error.\r
-     */\r
-    xmlError          lastError;\r
-    xmlParserMode     parseMode;    /* the parser mode */\r
-};\r
-\r
-/**\r
- * xmlSAXLocator:\r
- *\r
- * A SAX Locator.\r
- */\r
-struct _xmlSAXLocator {\r
-    const xmlChar *(*getPublicId)(void *ctx);\r
-    const xmlChar *(*getSystemId)(void *ctx);\r
-    int (*getLineNumber)(void *ctx);\r
-    int (*getColumnNumber)(void *ctx);\r
-};\r
-\r
-/**\r
- * xmlSAXHandler:\r
- *\r
- * A SAX handler is bunch of callbacks called by the parser when processing\r
- * of the input generate data or structure informations.\r
- */\r
-\r
-/**\r
- * resolveEntitySAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @publicId: The public ID of the entity\r
- * @systemId: The system ID of the entity\r
- *\r
- * Callback:\r
- * The entity loader, to control the loading of external entities,\r
- * the application can either:\r
- *    - override this resolveEntity() callback in the SAX block\r
- *    - or better use the xmlSetExternalEntityLoader() function to\r
- *      set up it's own entity resolution routine\r
- *\r
- * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.\r
- */\r
-typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,\r
-                               const xmlChar *publicId,\r
-                               const xmlChar *systemId);\r
-/**\r
- * internalSubsetSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  the root element name\r
- * @ExternalID:  the external ID\r
- * @SystemID:  the SYSTEM ID (e.g. filename or URL)\r
- *\r
- * Callback on internal subset declaration.\r
- */\r
-typedef void (*internalSubsetSAXFunc) (void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar *ExternalID,\r
-                               const xmlChar *SystemID);\r
-/**\r
- * externalSubsetSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  the root element name\r
- * @ExternalID:  the external ID\r
- * @SystemID:  the SYSTEM ID (e.g. filename or URL)\r
- *\r
- * Callback on external subset declaration.\r
- */\r
-typedef void (*externalSubsetSAXFunc) (void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar *ExternalID,\r
-                               const xmlChar *SystemID);\r
-/**\r
- * getEntitySAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name: The entity name\r
- *\r
- * Get an entity by name.\r
- *\r
- * Returns the xmlEntityPtr if found.\r
- */\r
-typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,\r
-                               const xmlChar *name);\r
-/**\r
- * getParameterEntitySAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name: The entity name\r
- *\r
- * Get a parameter entity by name.\r
- *\r
- * Returns the xmlEntityPtr if found.\r
- */\r
-typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,\r
-                               const xmlChar *name);\r
-/**\r
- * entityDeclSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  the entity name \r
- * @type:  the entity type \r
- * @publicId: The public ID of the entity\r
- * @systemId: The system ID of the entity\r
- * @content: the entity value (without processing).\r
- *\r
- * An entity definition has been parsed.\r
- */\r
-typedef void (*entityDeclSAXFunc) (void *ctx,\r
-                               const xmlChar *name,\r
-                               int type,\r
-                               const xmlChar *publicId,\r
-                               const xmlChar *systemId,\r
-                               xmlChar *content);\r
-/**\r
- * notationDeclSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name: The name of the notation\r
- * @publicId: The public ID of the entity\r
- * @systemId: The system ID of the entity\r
- *\r
- * What to do when a notation declaration has been parsed.\r
- */\r
-typedef void (*notationDeclSAXFunc)(void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar *publicId,\r
-                               const xmlChar *systemId);\r
-/**\r
- * attributeDeclSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @elem:  the name of the element\r
- * @fullname:  the attribute name \r
- * @type:  the attribute type \r
- * @def:  the type of default value\r
- * @defaultValue: the attribute default value\r
- * @tree:  the tree of enumerated value set\r
- *\r
- * An attribute definition has been parsed.\r
- */\r
-typedef void (*attributeDeclSAXFunc)(void *ctx,\r
-                               const xmlChar *elem,\r
-                               const xmlChar *fullname,\r
-                               int type,\r
-                               int def,\r
-                               const xmlChar *defaultValue,\r
-                               xmlEnumerationPtr tree);\r
-/**\r
- * elementDeclSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  the element name \r
- * @type:  the element type \r
- * @content: the element value tree\r
- *\r
- * An element definition has been parsed.\r
- */\r
-typedef void (*elementDeclSAXFunc)(void *ctx,\r
-                               const xmlChar *name,\r
-                               int type,\r
-                               xmlElementContentPtr content);\r
-/**\r
- * unparsedEntityDeclSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name: The name of the entity\r
- * @publicId: The public ID of the entity\r
- * @systemId: The system ID of the entity\r
- * @notationName: the name of the notation\r
- *\r
- * What to do when an unparsed entity declaration is parsed.\r
- */\r
-typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar *publicId,\r
-                               const xmlChar *systemId,\r
-                               const xmlChar *notationName);\r
-/**\r
- * setDocumentLocatorSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @loc: A SAX Locator\r
- *\r
- * Receive the document locator at startup, actually xmlDefaultSAXLocator.\r
- * Everything is available on the context, so this is useless in our case.\r
- */\r
-typedef void (*setDocumentLocatorSAXFunc) (void *ctx,\r
-                               xmlSAXLocatorPtr loc);\r
-/**\r
- * startDocumentSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- *\r
- * Called when the document start being processed.\r
- */\r
-typedef void (*startDocumentSAXFunc) (void *ctx);\r
-/**\r
- * endDocumentSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- *\r
- * Called when the document end has been detected.\r
- */\r
-typedef void (*endDocumentSAXFunc) (void *ctx);\r
-/**\r
- * startElementSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  The element name, including namespace prefix\r
- * @atts:  An array of name/value attributes pairs, NULL terminated\r
- *\r
- * Called when an opening tag has been processed.\r
- */\r
-typedef void (*startElementSAXFunc) (void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar **atts);\r
-/**\r
- * endElementSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  The element name\r
- *\r
- * Called when the end of an element has been detected.\r
- */\r
-typedef void (*endElementSAXFunc) (void *ctx,\r
-                               const xmlChar *name);\r
-/**\r
- * attributeSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  The attribute name, including namespace prefix\r
- * @value:  The attribute value\r
- *\r
- * Handle an attribute that has been read by the parser.\r
- * The default handling is to convert the attribute into an\r
- * DOM subtree and past it in a new xmlAttr element added to\r
- * the element.\r
- */\r
-typedef void (*attributeSAXFunc) (void *ctx,\r
-                               const xmlChar *name,\r
-                               const xmlChar *value);\r
-/**\r
- * referenceSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @name:  The entity name\r
- *\r
- * Called when an entity reference is detected. \r
- */\r
-typedef void (*referenceSAXFunc) (void *ctx,\r
-                               const xmlChar *name);\r
-/**\r
- * charactersSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @ch:  a xmlChar string\r
- * @len: the number of xmlChar\r
- *\r
- * Receiving some chars from the parser.\r
- */\r
-typedef void (*charactersSAXFunc) (void *ctx,\r
-                               const xmlChar *ch,\r
-                               int len);\r
-/**\r
- * ignorableWhitespaceSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @ch:  a xmlChar string\r
- * @len: the number of xmlChar\r
- *\r
- * Receiving some ignorable whitespaces from the parser.\r
- * UNUSED: by default the DOM building will use characters.\r
- */\r
-typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,\r
-                               const xmlChar *ch,\r
-                               int len);\r
-/**\r
- * processingInstructionSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @target:  the target name\r
- * @data: the PI data's\r
- *\r
- * A processing instruction has been parsed.\r
- */\r
-typedef void (*processingInstructionSAXFunc) (void *ctx,\r
-                               const xmlChar *target,\r
-                               const xmlChar *data);\r
-/**\r
- * commentSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @value:  the comment content\r
- *\r
- * A comment has been parsed.\r
- */\r
-typedef void (*commentSAXFunc) (void *ctx,\r
-                               const xmlChar *value);\r
-/**\r
- * cdataBlockSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- * @value:  The pcdata content\r
- * @len:  the block length\r
- *\r
- * Called when a pcdata block has been parsed.\r
- */\r
-typedef void (*cdataBlockSAXFunc) (\r
-                               void *ctx,\r
-                               const xmlChar *value,\r
-                               int len);\r
-/**\r
- * warningSAXFunc:\r
- * @ctx:  an XML parser context\r
- * @msg:  the message to display/transmit\r
- * @...:  extra parameters for the message display\r
- * \r
- * Display and format a warning messages, callback.\r
- */\r
-typedef void (*warningSAXFunc) (void *ctx,\r
-                               const char *msg, ...);\r
-/**\r
- * errorSAXFunc:\r
- * @ctx:  an XML parser context\r
- * @msg:  the message to display/transmit\r
- * @...:  extra parameters for the message display\r
- * \r
- * Display and format an error messages, callback.\r
- */\r
-typedef void (*errorSAXFunc) (void *ctx,\r
-                               const char *msg, ...);\r
-/**\r
- * fatalErrorSAXFunc:\r
- * @ctx:  an XML parser context\r
- * @msg:  the message to display/transmit\r
- * @...:  extra parameters for the message display\r
- * \r
- * Display and format fatal error messages, callback.\r
- * Note: so far fatalError() SAX callbacks are not used, error()\r
- *       get all the callbacks for errors.\r
- */\r
-typedef void (*fatalErrorSAXFunc) (void *ctx,\r
-                               const char *msg, ...);\r
-/**\r
- * isStandaloneSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- *\r
- * Is this document tagged standalone?\r
- *\r
- * Returns 1 if true\r
- */\r
-typedef int (*isStandaloneSAXFunc) (void *ctx);\r
-/**\r
- * hasInternalSubsetSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- *\r
- * Does this document has an internal subset.\r
- *\r
- * Returns 1 if true\r
- */\r
-typedef int (*hasInternalSubsetSAXFunc) (void *ctx);\r
-\r
-/**\r
- * hasExternalSubsetSAXFunc:\r
- * @ctx:  the user data (XML parser context)\r
- *\r
- * Does this document has an external subset?\r
- *\r
- * Returns 1 if true\r
- */\r
-typedef int (*hasExternalSubsetSAXFunc) (void *ctx);\r
-\r
-/************************************************************************\r
- *                                                                     *\r
- *                     The SAX version 2 API extensions                *\r
- *                                                                     *\r
- ************************************************************************/\r
-/**\r
- * XML_SAX2_MAGIC:\r
- *\r
- * Special constant found in SAX2 blocks initialized fields\r
- */\r
-#define XML_SAX2_MAGIC 0xDEEDBEAF\r
-\r
-/**\r
- * startElementNsSAX2Func:\r
- * @ctx:  the user data (XML parser context)\r
- * @localname:  the local name of the element\r
- * @prefix:  the element namespace prefix if available\r
- * @URI:  the element namespace name if available\r
- * @nb_namespaces:  number of namespace definitions on that node\r
- * @namespaces:  pointer to the array of prefix/URI pairs namespace definitions\r
- * @nb_attributes:  the number of attributes on that node\r
- * @nb_defaulted:  the number of defaulted attributes. The defaulted\r
- *                  ones are at the end of the array\r
- * @attributes:  pointer to the array of (localname/prefix/URI/value/end)\r
- *               attribute values.\r
- *\r
- * SAX2 callback when an element start has been detected by the parser.\r
- * It provides the namespace informations for the element, as well as\r
- * the new namespace declarations on the element.\r
- */\r
-\r
-typedef void (*startElementNsSAX2Func) (void *ctx,\r
-                                       const xmlChar *localname,\r
-                                       const xmlChar *prefix,\r
-                                       const xmlChar *URI,\r
-                                       int nb_namespaces,\r
-                                       const xmlChar **namespaces,\r
-                                       int nb_attributes,\r
-                                       int nb_defaulted,\r
-                                       const xmlChar **attributes);\r
\r
-/**\r
- * endElementNsSAX2Func:\r
- * @ctx:  the user data (XML parser context)\r
- * @localname:  the local name of the element\r
- * @prefix:  the element namespace prefix if available\r
- * @URI:  the element namespace name if available\r
- *\r
- * SAX2 callback when an element end has been detected by the parser.\r
- * It provides the namespace informations for the element.\r
- */\r
-\r
-typedef void (*endElementNsSAX2Func)   (void *ctx,\r
-                                       const xmlChar *localname,\r
-                                       const xmlChar *prefix,\r
-                                       const xmlChar *URI);\r
-\r
-\r
-struct _xmlSAXHandler {\r
-    internalSubsetSAXFunc internalSubset;\r
-    isStandaloneSAXFunc isStandalone;\r
-    hasInternalSubsetSAXFunc hasInternalSubset;\r
-    hasExternalSubsetSAXFunc hasExternalSubset;\r
-    resolveEntitySAXFunc resolveEntity;\r
-    getEntitySAXFunc getEntity;\r
-    entityDeclSAXFunc entityDecl;\r
-    notationDeclSAXFunc notationDecl;\r
-    attributeDeclSAXFunc attributeDecl;\r
-    elementDeclSAXFunc elementDecl;\r
-    unparsedEntityDeclSAXFunc unparsedEntityDecl;\r
-    setDocumentLocatorSAXFunc setDocumentLocator;\r
-    startDocumentSAXFunc startDocument;\r
-    endDocumentSAXFunc endDocument;\r
-    startElementSAXFunc startElement;\r
-    endElementSAXFunc endElement;\r
-    referenceSAXFunc reference;\r
-    charactersSAXFunc characters;\r
-    ignorableWhitespaceSAXFunc ignorableWhitespace;\r
-    processingInstructionSAXFunc processingInstruction;\r
-    commentSAXFunc comment;\r
-    warningSAXFunc warning;\r
-    errorSAXFunc error;\r
-    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */\r
-    getParameterEntitySAXFunc getParameterEntity;\r
-    cdataBlockSAXFunc cdataBlock;\r
-    externalSubsetSAXFunc externalSubset;\r
-    unsigned int initialized;\r
-    /* The following fields are extensions available only on version 2 */\r
-    void *_private;\r
-    startElementNsSAX2Func startElementNs;\r
-    endElementNsSAX2Func endElementNs;\r
-    xmlStructuredErrorFunc serror;\r
-};\r
-\r
-/*\r
- * SAX Version 1\r
- */\r
-typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;\r
-typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;\r
-struct _xmlSAXHandlerV1 {\r
-    internalSubsetSAXFunc internalSubset;\r
-    isStandaloneSAXFunc isStandalone;\r
-    hasInternalSubsetSAXFunc hasInternalSubset;\r
-    hasExternalSubsetSAXFunc hasExternalSubset;\r
-    resolveEntitySAXFunc resolveEntity;\r
-    getEntitySAXFunc getEntity;\r
-    entityDeclSAXFunc entityDecl;\r
-    notationDeclSAXFunc notationDecl;\r
-    attributeDeclSAXFunc attributeDecl;\r
-    elementDeclSAXFunc elementDecl;\r
-    unparsedEntityDeclSAXFunc unparsedEntityDecl;\r
-    setDocumentLocatorSAXFunc setDocumentLocator;\r
-    startDocumentSAXFunc startDocument;\r
-    endDocumentSAXFunc endDocument;\r
-    startElementSAXFunc startElement;\r
-    endElementSAXFunc endElement;\r
-    referenceSAXFunc reference;\r
-    charactersSAXFunc characters;\r
-    ignorableWhitespaceSAXFunc ignorableWhitespace;\r
-    processingInstructionSAXFunc processingInstruction;\r
-    commentSAXFunc comment;\r
-    warningSAXFunc warning;\r
-    errorSAXFunc error;\r
-    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */\r
-    getParameterEntitySAXFunc getParameterEntity;\r
-    cdataBlockSAXFunc cdataBlock;\r
-    externalSubsetSAXFunc externalSubset;\r
-    unsigned int initialized;\r
-};\r
-\r
-\r
-/**\r
- * xmlExternalEntityLoader:\r
- * @URL: The System ID of the resource requested\r
- * @ID: The Public ID of the resource requested\r
- * @context: the XML parser context \r
- *\r
- * External entity loaders types.\r
- *\r
- * Returns the entity input parser.\r
- */\r
-typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,\r
-                                        const char *ID,\r
-                                        xmlParserCtxtPtr context);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#include <libxml/encoding.h>\r
-#include <libxml/xmlIO.h>\r
-#include <libxml/globals.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-\r
-/*\r
- * Init/Cleanup\r
- */\r
-XMLPUBFUN void XMLCALL         \r
-               xmlInitParser           (void);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlCleanupParser        (void);\r
-\r
-/*\r
- * Input functions\r
- */\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParserInputRead      (xmlParserInputPtr in,\r
-                                        int len);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParserInputGrow      (xmlParserInputPtr in,\r
-                                        int len);\r
-\r
-/*\r
- * Basic parsing Interfaces\r
- */\r
-#ifdef LIBXML_SAX1_ENABLED\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlParseDoc             (const xmlChar *cur);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlParseFile            (const char *filename);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlParseMemory          (const char *buffer,\r
-                                        int size);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-XMLPUBFUN int XMLCALL          \r
-               xmlSubstituteEntitiesDefault(int val);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlKeepBlanksDefault    (int val);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlStopParser           (xmlParserCtxtPtr ctxt);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlPedanticParserDefault(int val);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlLineNumbersDefault   (int val);\r
-\r
-#ifdef LIBXML_SAX1_ENABLED\r
-/*\r
- * Recovery mode \r
- */\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlRecoverDoc           (xmlChar *cur);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlRecoverMemory        (const char *buffer,\r
-                                        int size);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlRecoverFile          (const char *filename);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-\r
-/*\r
- * Less common routines and SAX interfaces\r
- */\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParseDocument        (xmlParserCtxtPtr ctxt);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParseExtParsedEnt    (xmlParserCtxtPtr ctxt);\r
-#ifdef LIBXML_SAX1_ENABLED\r
-XMLPUBFUN int XMLCALL          \r
-               xmlSAXUserParseFile     (xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        const char *filename);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlSAXUserParseMemory   (xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        const char *buffer,\r
-                                        int size);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseDoc          (xmlSAXHandlerPtr sax,\r
-                                        const xmlChar *cur,\r
-                                        int recovery);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseMemory       (xmlSAXHandlerPtr sax,\r
-                                        const char *buffer,\r
-                                        int size,\r
-                                        int recovery);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,\r
-                                        const char *buffer,\r
-                                        int size,\r
-                                        int recovery,\r
-                                        void *data);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseFile         (xmlSAXHandlerPtr sax,\r
-                                        const char *filename,\r
-                                        int recovery);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,\r
-                                        const char *filename,\r
-                                        int recovery,\r
-                                        void *data);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlSAXParseEntity       (xmlSAXHandlerPtr sax,\r
-                                        const char *filename);\r
-XMLPUBFUN xmlDocPtr XMLCALL    \r
-               xmlParseEntity          (const char *filename);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-\r
-#ifdef LIBXML_VALID_ENABLED\r
-XMLPUBFUN xmlDtdPtr XMLCALL    \r
-               xmlSAXParseDTD          (xmlSAXHandlerPtr sax,\r
-                                        const xmlChar *ExternalID,\r
-                                        const xmlChar *SystemID);\r
-XMLPUBFUN xmlDtdPtr XMLCALL    \r
-               xmlParseDTD             (const xmlChar *ExternalID,\r
-                                        const xmlChar *SystemID);\r
-XMLPUBFUN xmlDtdPtr XMLCALL    \r
-               xmlIOParseDTD           (xmlSAXHandlerPtr sax,\r
-                                        xmlParserInputBufferPtr input,\r
-                                        xmlCharEncoding enc);\r
-#endif /* LIBXML_VALID_ENABLE */\r
-#ifdef LIBXML_SAX1_ENABLED\r
-XMLPUBFUN int XMLCALL  \r
-               xmlParseBalancedChunkMemory(xmlDocPtr doc,\r
-                                        xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        int depth,\r
-                                        const xmlChar *string,\r
-                                        xmlNodePtr *lst);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-XMLPUBFUN xmlParserErrors XMLCALL\r
-               xmlParseInNodeContext   (xmlNodePtr node,\r
-                                        const char *data,\r
-                                        int datalen,\r
-                                        int options,\r
-                                        xmlNodePtr *lst);\r
-#ifdef LIBXML_SAX1_ENABLED\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,\r
-                     xmlSAXHandlerPtr sax,\r
-                     void *user_data,\r
-                     int depth,\r
-                     const xmlChar *string,\r
-                     xmlNodePtr *lst,\r
-                     int recover);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParseExternalEntity  (xmlDocPtr doc,\r
-                                        xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        int depth,\r
-                                        const xmlChar *URL,\r
-                                        const xmlChar *ID,\r
-                                        xmlNodePtr *lst);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-XMLPUBFUN int XMLCALL          \r
-               xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,\r
-                                        const xmlChar *URL,\r
-                                        const xmlChar *ID,\r
-                                        xmlNodePtr *lst);\r
-\r
-/*\r
- * Parser contexts handling.\r
- */\r
-XMLPUBFUN xmlParserCtxtPtr XMLCALL     \r
-               xmlNewParserCtxt        (void);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlInitParserCtxt       (xmlParserCtxtPtr ctxt);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlClearParserCtxt      (xmlParserCtxtPtr ctxt);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlFreeParserCtxt       (xmlParserCtxtPtr ctxt);\r
-#ifdef LIBXML_SAX1_ENABLED\r
-XMLPUBFUN void XMLCALL         \r
-               xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,\r
-                                        const xmlChar* buffer,\r
-                                        const char *filename);\r
-#endif /* LIBXML_SAX1_ENABLED */\r
-XMLPUBFUN xmlParserCtxtPtr XMLCALL \r
-               xmlCreateDocParserCtxt  (const xmlChar *cur);\r
-\r
-#ifdef LIBXML_LEGACY_ENABLED\r
-/*\r
- * Reading/setting optional parsing features.\r
- */\r
-XMLPUBFUN int XMLCALL          \r
-               xmlGetFeaturesList      (int *len,\r
-                                        const char **result);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlGetFeature           (xmlParserCtxtPtr ctxt,\r
-                                        const char *name,\r
-                                        void *result);\r
-XMLPUBFUN int XMLCALL          \r
-               xmlSetFeature           (xmlParserCtxtPtr ctxt,\r
-                                        const char *name,\r
-                                        void *value);\r
-#endif /* LIBXML_LEGACY_ENABLED */\r
-\r
-#ifdef LIBXML_PUSH_ENABLED\r
-/*\r
- * Interfaces for the Push mode.\r
- */\r
-XMLPUBFUN xmlParserCtxtPtr XMLCALL \r
-               xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        const char *chunk,\r
-                                        int size,\r
-                                        const char *filename);\r
-XMLPUBFUN int XMLCALL           \r
-               xmlParseChunk           (xmlParserCtxtPtr ctxt,\r
-                                        const char *chunk,\r
-                                        int size,\r
-                                        int terminate);\r
-#endif /* LIBXML_PUSH_ENABLED */\r
-\r
-/*\r
- * Special I/O mode.\r
- */\r
-\r
-XMLPUBFUN xmlParserCtxtPtr XMLCALL \r
-               xmlCreateIOParserCtxt   (xmlSAXHandlerPtr sax,\r
-                                        void *user_data,\r
-                                        xmlInputReadCallback   ioread,\r
-                                        xmlInputCloseCallback  ioclose,\r
-                                        void *ioctx,\r
-                                        xmlCharEncoding enc);\r
-\r
-XMLPUBFUN xmlParserInputPtr XMLCALL \r
-               xmlNewIOInputStream     (xmlParserCtxtPtr ctxt,\r
-                                        xmlParserInputBufferPtr input,\r
-                                        xmlCharEncoding enc);\r
-\r
-/*\r
- * Node infos.\r
- */\r
-XMLPUBFUN const xmlParserNodeInfo* XMLCALL\r
-               xmlParserFindNodeInfo   (const xmlParserCtxtPtr ctxt,\r
-                                        const xmlNodePtr node);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlInitNodeInfoSeq      (xmlParserNodeInfoSeqPtr seq);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlClearNodeInfoSeq     (xmlParserNodeInfoSeqPtr seq);\r
-XMLPUBFUN unsigned long XMLCALL \r
-               xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,\r
-                                         const xmlNodePtr node);\r
-XMLPUBFUN void XMLCALL         \r
-               xmlParserAddNodeInfo    (xmlParserCtxtPtr ctxt,\r
-                                        const xmlParserNodeInfoPtr info);\r
-\r
-/*\r
- * External entities handling actually implemented in xmlIO.\r
- */\r
-\r
-XMLPUBFUN void XMLCALL         \r
-               xmlSetExternalEntityLoader(xmlExternalEntityLoader f);\r
-XMLPUBFUN xmlExternalEntityLoader XMLCALL\r
-               xmlGetExternalEntityLoader(void);\r
-XMLPUBFUN xmlParserInputPtr XMLCALL\r
-               xmlLoadExternalEntity   (const char *URL,\r
-                                        const char *ID,\r
-                                        xmlParserCtxtPtr ctxt);\r
-\r
-/*\r
- * Index lookup, actually implemented in the encoding module\r
- */\r
-XMLPUBFUN long XMLCALL\r
-               xmlByteConsumed         (xmlParserCtxtPtr ctxt);\r
-\r
-/*\r
- * New set of simpler/more flexible APIs\r
- */\r
-/**\r
- * xmlParserOption:\r
- *\r
- * This is the set of XML parser options that can be passed down\r
- * to the xmlReadDoc() and similar calls.\r
- */\r
-typedef enum {\r
-    XML_PARSE_RECOVER  = 1<<0, /* recover on errors */\r
-    XML_PARSE_NOENT    = 1<<1, /* substitute entities */\r
-    XML_PARSE_DTDLOAD  = 1<<2, /* load the external subset */\r
-    XML_PARSE_DTDATTR  = 1<<3, /* default DTD attributes */\r
-    XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */\r
-    XML_PARSE_NOERROR  = 1<<5, /* suppress error reports */\r
-    XML_PARSE_NOWARNING        = 1<<6, /* suppress warning reports */\r
-    XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */\r
-    XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */\r
-    XML_PARSE_SAX1     = 1<<9, /* use the SAX1 interface internally */\r
-    XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition  */\r
-    XML_PARSE_NONET    = 1<<11,/* Forbid network access */\r
-    XML_PARSE_NODICT   = 1<<12,/* Do not reuse the context dictionnary */\r
-    XML_PARSE_NSCLEAN  = 1<<13,/* remove redundant namespaces declarations */\r
-    XML_PARSE_NOCDATA  = 1<<14,/* merge CDATA as text nodes */\r
-    XML_PARSE_NOXINCNODE= 1<<15 /* do not generate XINCLUDE START/END nodes */\r
-} xmlParserOption;\r
-\r
-XMLPUBFUN void XMLCALL\r
-               xmlCtxtReset            (xmlParserCtxtPtr ctxt);\r
-XMLPUBFUN int XMLCALL\r
-               xmlCtxtResetPush        (xmlParserCtxtPtr ctxt,\r
-                                        const char *chunk,\r
-                                        int size,\r
-                                        const char *filename,\r
-                                        const char *encoding);\r
-XMLPUBFUN int XMLCALL\r
-               xmlCtxtUseOptions       (xmlParserCtxtPtr ctxt,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlReadDoc              (const xmlChar *cur,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlReadFile             (const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlReadMemory           (const char *buffer,\r
-                                        int size,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlReadFd               (int fd,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlReadIO               (xmlInputReadCallback ioread,\r
-                                        xmlInputCloseCallback ioclose,\r
-                                        void *ioctx,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlCtxtReadDoc          (xmlParserCtxtPtr ctxt,\r
-                                        const xmlChar *cur,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlCtxtReadFile         (xmlParserCtxtPtr ctxt,\r
-                                        const char *filename,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlCtxtReadMemory               (xmlParserCtxtPtr ctxt,\r
-                                        const char *buffer,\r
-                                        int size,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlCtxtReadFd           (xmlParserCtxtPtr ctxt,\r
-                                        int fd,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-XMLPUBFUN xmlDocPtr XMLCALL\r
-               xmlCtxtReadIO           (xmlParserCtxtPtr ctxt,\r
-                                        xmlInputReadCallback ioread,\r
-                                        xmlInputCloseCallback ioclose,\r
-                                        void *ioctx,\r
-                                        const char *URL,\r
-                                        const char *encoding,\r
-                                        int options);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* __XML_PARSER_H__ */\r
-\r
+/*
+ * Summary: the core parser module
+ * Description: Interfaces, constants and types related to the XML parser
+ *
+ * Copy: See Copyright for the status of this software.
+ *
+ * Author: Daniel Veillard
+ */
+
+#ifndef __XML_PARSER_H__
+#define __XML_PARSER_H__
+
+#include <stdarg.h>
+
+#include <libxml/xmlversion.h>
+#include <libxml/tree.h>
+#include <libxml/dict.h>
+#include <libxml/hash.h>
+#include <libxml/valid.h>
+#include <libxml/entities.h>
+#include <libxml/xmlerror.h>
+#include <libxml/xmlstring.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * XML_DEFAULT_VERSION:
+ *
+ * The default version of XML used: 1.0
+ */
+#define XML_DEFAULT_VERSION    "1.0"
+
+/**
+ * xmlParserInput:
+ *
+ * An xmlParserInput is an input flow for the XML processor.
+ * Each entity parsed is associated an xmlParserInput (except the
+ * few predefined ones). This is the case both for internal entities
+ * - in which case the flow is already completely in memory - or
+ * external entities - in which case we use the buf structure for
+ * progressive reading and I18N conversions to the internal UTF-8 format.
+ */
+
+/**
+ * xmlParserInputDeallocate:
+ * @str:  the string to deallocate
+ *
+ * Callback for freeing some parser input allocations.
+ */
+typedef void (* xmlParserInputDeallocate)(xmlChar *str);
+
+struct _xmlParserInput {
+    /* Input buffer */
+    xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
+
+    const char *filename;             /* The file analyzed, if any */
+    const char *directory;            /* the directory/base of the file */
+    const xmlChar *base;              /* Base of the array to parse */
+    const xmlChar *cur;               /* Current char being parsed */
+    const xmlChar *end;               /* end of the array to parse */
+    int length;                       /* length if known */
+    int line;                         /* Current line */
+    int col;                          /* Current column */
+    /*
+     * NOTE: consumed is only tested for equality in the parser code,
+     *       so even if there is an overflow this should not give troubles
+     *       for parsing very large instances.
+     */
+    unsigned long consumed;           /* How many xmlChars already consumed */
+    xmlParserInputDeallocate free;    /* function to deallocate the base */
+    const xmlChar *encoding;          /* the encoding string for entity */
+    const xmlChar *version;           /* the version string for entity */
+    int standalone;                   /* Was that entity marked standalone */
+    int id;                           /* an unique identifier for the entity */
+};
+
+/**
+ * xmlParserNodeInfo:
+ *
+ * The parser can be asked to collect Node informations, i.e. at what
+ * place in the file they were detected. 
+ * NOTE: This is off by default and not very well tested.
+ */
+typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
+typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
+
+struct _xmlParserNodeInfo {
+  const struct _xmlNode* node;
+  /* Position & line # that text that created the node begins & ends on */
+  unsigned long begin_pos;
+  unsigned long begin_line;
+  unsigned long end_pos;
+  unsigned long end_line;
+};
+
+typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
+typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
+struct _xmlParserNodeInfoSeq {
+  unsigned long maximum;
+  unsigned long length;
+  xmlParserNodeInfo* buffer;
+};
+
+/**
+ * xmlParserInputState:
+ *
+ * The parser is now working also as a state based parser.
+ * The recursive one use the state info for entities processing.
+ */
+typedef enum {
+    XML_PARSER_EOF = -1,       /* nothing is to be parsed */
+    XML_PARSER_START = 0,      /* nothing has been parsed */
+    XML_PARSER_MISC,           /* Misc* before int subset */
+    XML_PARSER_PI,             /* Within a processing instruction */
+    XML_PARSER_DTD,            /* within some DTD content */
+    XML_PARSER_PROLOG,         /* Misc* after internal subset */
+    XML_PARSER_COMMENT,                /* within a comment */
+    XML_PARSER_START_TAG,      /* within a start tag */
+    XML_PARSER_CONTENT,                /* within the content */
+    XML_PARSER_CDATA_SECTION,  /* within a CDATA section */
+    XML_PARSER_END_TAG,                /* within a closing tag */
+    XML_PARSER_ENTITY_DECL,    /* within an entity declaration */
+    XML_PARSER_ENTITY_VALUE,   /* within an entity value in a decl */
+    XML_PARSER_ATTRIBUTE_VALUE,        /* within an attribute value */
+    XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
+    XML_PARSER_EPILOG,                 /* the Misc* after the last end tag */
+    XML_PARSER_IGNORE,         /* within an IGNORED section */
+    XML_PARSER_PUBLIC_LITERAL  /* within a PUBLIC value */
+} xmlParserInputState;
+
+/**
+ * XML_DETECT_IDS:
+ *
+ * Bit in the loadsubset context field to tell to do ID/REFs lookups.
+ * Use it to initialize xmlLoadExtDtdDefaultValue.
+ */
+#define XML_DETECT_IDS         2
+
+/**
+ * XML_COMPLETE_ATTRS:
+ *
+ * Bit in the loadsubset context field to tell to do complete the
+ * elements attributes lists with the ones defaulted from the DTDs.
+ * Use it to initialize xmlLoadExtDtdDefaultValue.
+ */
+#define XML_COMPLETE_ATTRS     4
+
+/**
+ * XML_SKIP_IDS:
+ *
+ * Bit in the loadsubset context field to tell to not do ID/REFs registration.
+ * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
+ */
+#define XML_SKIP_IDS           8
+
+/**
+ * xmlParserMode:
+ *
+ * A parser can operate in various modes
+ */
+typedef enum {
+    XML_PARSE_UNKNOWN = 0,
+    XML_PARSE_DOM = 1,
+    XML_PARSE_SAX = 2,
+    XML_PARSE_PUSH_DOM = 3,
+    XML_PARSE_PUSH_SAX = 4,
+    XML_PARSE_READER = 5
+} xmlParserMode;
+
+/**
+ * xmlParserCtxt:
+ *
+ * The parser context.
+ * NOTE This doesn't completely define the parser state, the (current ?)
+ *      design of the parser uses recursive function calls since this allow
+ *      and easy mapping from the production rules of the specification
+ *      to the actual code. The drawback is that the actual function call
+ *      also reflect the parser state. However most of the parsing routines
+ *      takes as the only argument the parser context pointer, so migrating
+ *      to a state based parser for progressive parsing shouldn't be too hard.
+ */
+struct _xmlParserCtxt {
+    struct _xmlSAXHandler *sax;       /* The SAX handler */
+    void            *userData;        /* For SAX interface only, used by DOM build */
+    xmlDocPtr           myDoc;        /* the document being built */
+    int            wellFormed;        /* is the document well formed */
+    int       replaceEntities;        /* shall we replace entities ? */
+    const xmlChar    *version;        /* the XML version string */
+    const xmlChar   *encoding;        /* the declared encoding, if any */
+    int            standalone;        /* standalone document */
+    int                  html;        /* an HTML(1)/Docbook(2) document */
+
+    /* Input stream stack */
+    xmlParserInputPtr  input;         /* Current input stream */
+    int                inputNr;       /* Number of current input streams */
+    int                inputMax;      /* Max number of input streams */
+    xmlParserInputPtr *inputTab;      /* stack of inputs */
+
+    /* Node analysis stack only used for DOM building */
+    xmlNodePtr         node;          /* Current parsed Node */
+    int                nodeNr;        /* Depth of the parsing stack */
+    int                nodeMax;       /* Max depth of the parsing stack */
+    xmlNodePtr        *nodeTab;       /* array of nodes */
+
+    int record_info;                  /* Whether node info should be kept */
+    xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
+
+    int errNo;                        /* error code */
+
+    int     hasExternalSubset;        /* reference and external subset */
+    int             hasPErefs;        /* the internal subset has PE refs */
+    int              external;        /* are we parsing an external entity */
+
+    int                 valid;        /* is the document valid */
+    int              validate;        /* shall we try to validate ? */
+    xmlValidCtxt        vctxt;        /* The validity context */
+
+    xmlParserInputState instate;      /* current type of input */
+    int                 token;        /* next char look-ahead */    
+
+    char           *directory;        /* the data directory */
+
+    /* Node name stack */
+    const xmlChar     *name;          /* Current parsed Node */
+    int                nameNr;        /* Depth of the parsing stack */
+    int                nameMax;       /* Max depth of the parsing stack */
+    const xmlChar *   *nameTab;       /* array of nodes */
+
+    long               nbChars;       /* number of xmlChar processed */
+    long            checkIndex;       /* used by progressive parsing lookup */
+    int             keepBlanks;       /* ugly but ... */
+    int             disableSAX;       /* SAX callbacks are disabled */
+    int               inSubset;       /* Parsing is in int 1/ext 2 subset */
+    const xmlChar *    intSubName;    /* name of subset */
+    xmlChar *          extSubURI;     /* URI of external subset */
+    xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
+
+    /* xml:space values */
+    int *              space;         /* Should the parser preserve spaces */
+    int                spaceNr;       /* Depth of the parsing stack */
+    int                spaceMax;      /* Max depth of the parsing stack */
+    int *              spaceTab;      /* array of space infos */
+
+    int                depth;         /* to prevent entity substitution loops */
+    xmlParserInputPtr  entity;        /* used to check entities boundaries */
+    int                charset;       /* encoding of the in-memory content
+                                        actually an xmlCharEncoding */
+    int                nodelen;       /* Those two fields are there to */
+    int                nodemem;       /* Speed up large node parsing */
+    int                pedantic;      /* signal pedantic warnings */
+    void              *_private;      /* For user data, libxml won't touch it */
+
+    int                loadsubset;    /* should the external subset be loaded */
+    int                linenumbers;   /* set line number in element content */
+    void              *catalogs;      /* document's own catalog */
+    int                recovery;      /* run in recovery mode */
+    int                progressive;   /* is this a progressive parsing */
+    xmlDictPtr         dict;          /* dictionnary for the parser */
+    const xmlChar *   *atts;          /* array for the attributes callbacks */
+    int                maxatts;       /* the size of the array */
+    int                docdict;       /* use strings from dict to build tree */
+
+    /*
+     * pre-interned strings
+     */
+    const xmlChar *str_xml;
+    const xmlChar *str_xmlns;
+    const xmlChar *str_xml_ns;
+
+    /*
+     * Everything below is used only by the new SAX mode
+     */
+    int                sax2;          /* operating in the new SAX mode */
+    int                nsNr;          /* the number of inherited namespaces */
+    int                nsMax;         /* the size of the arrays */
+    const xmlChar *   *nsTab;         /* the array of prefix/namespace name */
+    int               *attallocs;     /* which attribute were allocated */
+    void *            *pushTab;       /* array of data for push */
+    xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */
+    xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */
+    int                nsWellFormed;  /* is the document XML Nanespace okay */
+    int                options;       /* Extra options */
+
+    /*
+     * Those fields are needed only for treaming parsing so far
+     */
+    int               dictNames;    /* Use dictionary names for the tree */
+    int               freeElemsNr;  /* number of freed element nodes */
+    xmlNodePtr        freeElems;    /* List of freed element nodes */
+    int               freeAttrsNr;  /* number of freed attributes nodes */
+    xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */
+
+    /*
+     * the complete error informations for the last error.
+     */
+    xmlError          lastError;
+    xmlParserMode     parseMode;    /* the parser mode */
+};
+
+/**
+ * xmlSAXLocator:
+ *
+ * A SAX Locator.
+ */
+struct _xmlSAXLocator {
+    const xmlChar *(*getPublicId)(void *ctx);
+    const xmlChar *(*getSystemId)(void *ctx);
+    int (*getLineNumber)(void *ctx);
+    int (*getColumnNumber)(void *ctx);
+};
+
+/**
+ * xmlSAXHandler:
+ *
+ * A SAX handler is bunch of callbacks called by the parser when processing
+ * of the input generate data or structure informations.
+ */
+
+/**
+ * resolveEntitySAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @publicId: The public ID of the entity
+ * @systemId: The system ID of the entity
+ *
+ * Callback:
+ * The entity loader, to control the loading of external entities,
+ * the application can either:
+ *    - override this resolveEntity() callback in the SAX block
+ *    - or better use the xmlSetExternalEntityLoader() function to
+ *      set up it's own entity resolution routine
+ *
+ * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
+ */
+typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
+                               const xmlChar *publicId,
+                               const xmlChar *systemId);
+/**
+ * internalSubsetSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  the root element name
+ * @ExternalID:  the external ID
+ * @SystemID:  the SYSTEM ID (e.g. filename or URL)
+ *
+ * Callback on internal subset declaration.
+ */
+typedef void (*internalSubsetSAXFunc) (void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *ExternalID,
+                               const xmlChar *SystemID);
+/**
+ * externalSubsetSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  the root element name
+ * @ExternalID:  the external ID
+ * @SystemID:  the SYSTEM ID (e.g. filename or URL)
+ *
+ * Callback on external subset declaration.
+ */
+typedef void (*externalSubsetSAXFunc) (void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *ExternalID,
+                               const xmlChar *SystemID);
+/**
+ * getEntitySAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name: The entity name
+ *
+ * Get an entity by name.
+ *
+ * Returns the xmlEntityPtr if found.
+ */
+typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
+                               const xmlChar *name);
+/**
+ * getParameterEntitySAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name: The entity name
+ *
+ * Get a parameter entity by name.
+ *
+ * Returns the xmlEntityPtr if found.
+ */
+typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
+                               const xmlChar *name);
+/**
+ * entityDeclSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  the entity name 
+ * @type:  the entity type 
+ * @publicId: The public ID of the entity
+ * @systemId: The system ID of the entity
+ * @content: the entity value (without processing).
+ *
+ * An entity definition has been parsed.
+ */
+typedef void (*entityDeclSAXFunc) (void *ctx,
+                               const xmlChar *name,
+                               int type,
+                               const xmlChar *publicId,
+                               const xmlChar *systemId,
+                               xmlChar *content);
+/**
+ * notationDeclSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name: The name of the notation
+ * @publicId: The public ID of the entity
+ * @systemId: The system ID of the entity
+ *
+ * What to do when a notation declaration has been parsed.
+ */
+typedef void (*notationDeclSAXFunc)(void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *publicId,
+                               const xmlChar *systemId);
+/**
+ * attributeDeclSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @elem:  the name of the element
+ * @fullname:  the attribute name 
+ * @type:  the attribute type 
+ * @def:  the type of default value
+ * @defaultValue: the attribute default value
+ * @tree:  the tree of enumerated value set
+ *
+ * An attribute definition has been parsed.
+ */
+typedef void (*attributeDeclSAXFunc)(void *ctx,
+                               const xmlChar *elem,
+                               const xmlChar *fullname,
+                               int type,
+                               int def,
+                               const xmlChar *defaultValue,
+                               xmlEnumerationPtr tree);
+/**
+ * elementDeclSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  the element name 
+ * @type:  the element type 
+ * @content: the element value tree
+ *
+ * An element definition has been parsed.
+ */
+typedef void (*elementDeclSAXFunc)(void *ctx,
+                               const xmlChar *name,
+                               int type,
+                               xmlElementContentPtr content);
+/**
+ * unparsedEntityDeclSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name: The name of the entity
+ * @publicId: The public ID of the entity
+ * @systemId: The system ID of the entity
+ * @notationName: the name of the notation
+ *
+ * What to do when an unparsed entity declaration is parsed.
+ */
+typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *publicId,
+                               const xmlChar *systemId,
+                               const xmlChar *notationName);
+/**
+ * setDocumentLocatorSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @loc: A SAX Locator
+ *
+ * Receive the document locator at startup, actually xmlDefaultSAXLocator.
+ * Everything is available on the context, so this is useless in our case.
+ */
+typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
+                               xmlSAXLocatorPtr loc);
+/**
+ * startDocumentSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ *
+ * Called when the document start being processed.
+ */
+typedef void (*startDocumentSAXFunc) (void *ctx);
+/**
+ * endDocumentSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ *
+ * Called when the document end has been detected.
+ */
+typedef void (*endDocumentSAXFunc) (void *ctx);
+/**
+ * startElementSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  The element name, including namespace prefix
+ * @atts:  An array of name/value attributes pairs, NULL terminated
+ *
+ * Called when an opening tag has been processed.
+ */
+typedef void (*startElementSAXFunc) (void *ctx,
+                               const xmlChar *name,
+                               const xmlChar **atts);
+/**
+ * endElementSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  The element name
+ *
+ * Called when the end of an element has been detected.
+ */
+typedef void (*endElementSAXFunc) (void *ctx,
+                               const xmlChar *name);
+/**
+ * attributeSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  The attribute name, including namespace prefix
+ * @value:  The attribute value
+ *
+ * Handle an attribute that has been read by the parser.
+ * The default handling is to convert the attribute into an
+ * DOM subtree and past it in a new xmlAttr element added to
+ * the element.
+ */
+typedef void (*attributeSAXFunc) (void *ctx,
+                               const xmlChar *name,
+                               const xmlChar *value);
+/**
+ * referenceSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @name:  The entity name
+ *
+ * Called when an entity reference is detected. 
+ */
+typedef void (*referenceSAXFunc) (void *ctx,
+                               const xmlChar *name);
+/**
+ * charactersSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @ch:  a xmlChar string
+ * @len: the number of xmlChar
+ *
+ * Receiving some chars from the parser.
+ */
+typedef void (*charactersSAXFunc) (void *ctx,
+                               const xmlChar *ch,
+                               int len);
+/**
+ * ignorableWhitespaceSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @ch:  a xmlChar string
+ * @len: the number of xmlChar
+ *
+ * Receiving some ignorable whitespaces from the parser.
+ * UNUSED: by default the DOM building will use characters.
+ */
+typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
+                               const xmlChar *ch,
+                               int len);
+/**
+ * processingInstructionSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @target:  the target name
+ * @data: the PI data's
+ *
+ * A processing instruction has been parsed.
+ */
+typedef void (*processingInstructionSAXFunc) (void *ctx,
+                               const xmlChar *target,
+                               const xmlChar *data);
+/**
+ * commentSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @value:  the comment content
+ *
+ * A comment has been parsed.
+ */
+typedef void (*commentSAXFunc) (void *ctx,
+                               const xmlChar *value);
+/**
+ * cdataBlockSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ * @value:  The pcdata content
+ * @len:  the block length
+ *
+ * Called when a pcdata block has been parsed.
+ */
+typedef void (*cdataBlockSAXFunc) (
+                               void *ctx,
+                               const xmlChar *value,
+                               int len);
+/**
+ * warningSAXFunc:
+ * @ctx:  an XML parser context
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ * 
+ * Display and format a warning messages, callback.
+ */
+typedef void (*warningSAXFunc) (void *ctx,
+                               const char *msg, ...);
+/**
+ * errorSAXFunc:
+ * @ctx:  an XML parser context
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ * 
+ * Display and format an error messages, callback.
+ */
+typedef void (*errorSAXFunc) (void *ctx,
+                               const char *msg, ...);
+/**
+ * fatalErrorSAXFunc:
+ * @ctx:  an XML parser context
+ * @msg:  the message to display/transmit
+ * @...:  extra parameters for the message display
+ * 
+ * Display and format fatal error messages, callback.
+ * Note: so far fatalError() SAX callbacks are not used, error()
+ *       get all the callbacks for errors.
+ */
+typedef void (*fatalErrorSAXFunc) (void *ctx,
+                               const char *msg, ...);
+/**
+ * isStandaloneSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ *
+ * Is this document tagged standalone?
+ *
+ * Returns 1 if true
+ */
+typedef int (*isStandaloneSAXFunc) (void *ctx);
+/**
+ * hasInternalSubsetSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ *
+ * Does this document has an internal subset.
+ *
+ * Returns 1 if true
+ */
+typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
+
+/**
+ * hasExternalSubsetSAXFunc:
+ * @ctx:  the user data (XML parser context)
+ *
+ * Does this document has an external subset?
+ *
+ * Returns 1 if true
+ */
+typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
+
+/************************************************************************
+ *                                                                     *
+ *                     The SAX version 2 API extensions                *
+ *                                                                     *
+ ************************************************************************/
+/**
+ * XML_SAX2_MAGIC:
+ *
+ * Special constant found in SAX2 blocks initialized fields
+ */
+#define XML_SAX2_MAGIC 0xDEEDBEAF
+
+/**
+ * startElementNsSAX2Func:
+ * @ctx:  the user data (XML parser context)
+ * @localname:  the local name of the element
+ * @prefix:  the element namespace prefix if available
+ * @URI:  the element namespace name if available
+ * @nb_namespaces:  number of namespace definitions on that node
+ * @namespaces:  pointer to the array of prefix/URI pairs namespace definitions
+ * @nb_attributes:  the number of attributes on that node
+ * @nb_defaulted:  the number of defaulted attributes. The defaulted
+ *                  ones are at the end of the array
+ * @attributes:  pointer to the array of (localname/prefix/URI/value/end)
+ *               attribute values.
+ *
+ * SAX2 callback when an element start has been detected by the parser.
+ * It provides the namespace informations for the element, as well as
+ * the new namespace declarations on the element.
+ */
+
+typedef void (*startElementNsSAX2Func) (void *ctx,
+                                       const xmlChar *localname,
+                                       const xmlChar *prefix,
+                                       const xmlChar *URI,
+                                       int nb_namespaces,
+                                       const xmlChar **namespaces,
+                                       int nb_attributes,
+                                       int nb_defaulted,
+                                       const xmlChar **attributes);
+/**
+ * endElementNsSAX2Func:
+ * @ctx:  the user data (XML parser context)
+ * @localname:  the local name of the element
+ * @prefix:  the element namespace prefix if available
+ * @URI:  the element namespace name if available
+ *
+ * SAX2 callback when an element end has been detected by the parser.
+ * It provides the namespace informations for the element.
+ */
+
+typedef void (*endElementNsSAX2Func)   (void *ctx,
+                                       const xmlChar *localname,
+                                       const xmlChar *prefix,
+                                       const xmlChar *URI);
+
+
+struct _xmlSAXHandler {
+    internalSubsetSAXFunc internalSubset;
+    isStandaloneSAXFunc isStandalone;
+    hasInternalSubsetSAXFunc hasInternalSubset;
+    hasExternalSubsetSAXFunc hasExternalSubset;
+    resolveEntitySAXFunc resolveEntity;
+    getEntitySAXFunc getEntity;
+    entityDeclSAXFunc entityDecl;
+    notationDeclSAXFunc notationDecl;
+    attributeDeclSAXFunc attributeDecl;
+    elementDeclSAXFunc elementDecl;
+    unparsedEntityDeclSAXFunc unparsedEntityDecl;
+    setDocumentLocatorSAXFunc setDocumentLocator;
+    startDocumentSAXFunc startDocument;
+    endDocumentSAXFunc endDocument;
+    startElementSAXFunc startElement;
+    endElementSAXFunc endElement;
+    referenceSAXFunc reference;
+    charactersSAXFunc characters;
+    ignorableWhitespaceSAXFunc ignorableWhitespace;
+    processingInstructionSAXFunc processingInstruction;
+    commentSAXFunc comment;
+    warningSAXFunc warning;
+    errorSAXFunc error;
+    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
+    getParameterEntitySAXFunc getParameterEntity;
+    cdataBlockSAXFunc cdataBlock;
+    externalSubsetSAXFunc externalSubset;
+    unsigned int initialized;
+    /* The following fields are extensions available only on version 2 */
+    void *_private;
+    startElementNsSAX2Func startElementNs;
+    endElementNsSAX2Func endElementNs;
+    xmlStructuredErrorFunc serror;
+};
+
+/*
+ * SAX Version 1
+ */
+typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
+typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
+struct _xmlSAXHandlerV1 {
+    internalSubsetSAXFunc internalSubset;
+    isStandaloneSAXFunc isStandalone;
+    hasInternalSubsetSAXFunc hasInternalSubset;
+    hasExternalSubsetSAXFunc hasExternalSubset;
+    resolveEntitySAXFunc resolveEntity;
+    getEntitySAXFunc getEntity;
+    entityDeclSAXFunc entityDecl;
+    notationDeclSAXFunc notationDecl;
+    attributeDeclSAXFunc attributeDecl;
+    elementDeclSAXFunc elementDecl;
+    unparsedEntityDeclSAXFunc unparsedEntityDecl;
+    setDocumentLocatorSAXFunc setDocumentLocator;
+    startDocumentSAXFunc startDocument;
+    endDocumentSAXFunc endDocument;
+    startElementSAXFunc startElement;
+    endElementSAXFunc endElement;
+    referenceSAXFunc reference;
+    charactersSAXFunc characters;
+    ignorableWhitespaceSAXFunc ignorableWhitespace;
+    processingInstructionSAXFunc processingInstruction;
+    commentSAXFunc comment;
+    warningSAXFunc warning;
+    errorSAXFunc error;
+    fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
+    getParameterEntitySAXFunc getParameterEntity;
+    cdataBlockSAXFunc cdataBlock;
+    externalSubsetSAXFunc externalSubset;
+    unsigned int initialized;
+};
+
+
+/**
+ * xmlExternalEntityLoader:
+ * @URL: The System ID of the resource requested
+ * @ID: The Public ID of the resource requested
+ * @context: the XML parser context 
+ *
+ * External entity loaders types.
+ *
+ * Returns the entity input parser.
+ */
+typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
+                                        const char *ID,
+                                        xmlParserCtxtPtr context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <libxml/encoding.h>
+#include <libxml/xmlIO.h>
+#include <libxml/globals.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Init/Cleanup
+ */
+XMLPUBFUN void XMLCALL         
+               xmlInitParser           (void);
+XMLPUBFUN void XMLCALL         
+               xmlCleanupParser        (void);
+
+/*
+ * Input functions
+ */
+XMLPUBFUN int XMLCALL          
+               xmlParserInputRead      (xmlParserInputPtr in,
+                                        int len);
+XMLPUBFUN int XMLCALL          
+               xmlParserInputGrow      (xmlParserInputPtr in,
+                                        int len);
+
+/*
+ * Basic parsing Interfaces
+ */
+#ifdef LIBXML_SAX1_ENABLED
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlParseDoc             (const xmlChar *cur);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlParseFile            (const char *filename);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlParseMemory          (const char *buffer,
+                                        int size);
+#endif /* LIBXML_SAX1_ENABLED */
+XMLPUBFUN int XMLCALL          
+               xmlSubstituteEntitiesDefault(int val);
+XMLPUBFUN int XMLCALL          
+               xmlKeepBlanksDefault    (int val);
+XMLPUBFUN void XMLCALL         
+               xmlStopParser           (xmlParserCtxtPtr ctxt);
+XMLPUBFUN int XMLCALL          
+               xmlPedanticParserDefault(int val);
+XMLPUBFUN int XMLCALL          
+               xmlLineNumbersDefault   (int val);
+
+#ifdef LIBXML_SAX1_ENABLED
+/*
+ * Recovery mode 
+ */
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlRecoverDoc           (xmlChar *cur);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlRecoverMemory        (const char *buffer,
+                                        int size);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlRecoverFile          (const char *filename);
+#endif /* LIBXML_SAX1_ENABLED */
+
+/*
+ * Less common routines and SAX interfaces
+ */
+XMLPUBFUN int XMLCALL          
+               xmlParseDocument        (xmlParserCtxtPtr ctxt);
+XMLPUBFUN int XMLCALL          
+               xmlParseExtParsedEnt    (xmlParserCtxtPtr ctxt);
+#ifdef LIBXML_SAX1_ENABLED
+XMLPUBFUN int XMLCALL          
+               xmlSAXUserParseFile     (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        const char *filename);
+XMLPUBFUN int XMLCALL          
+               xmlSAXUserParseMemory   (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        const char *buffer,
+                                        int size);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseDoc          (xmlSAXHandlerPtr sax,
+                                        const xmlChar *cur,
+                                        int recovery);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseMemory       (xmlSAXHandlerPtr sax,
+                                        const char *buffer,
+                                        int size,
+                                        int recovery);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
+                                        const char *buffer,
+                                        int size,
+                                        int recovery,
+                                        void *data);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseFile         (xmlSAXHandlerPtr sax,
+                                        const char *filename,
+                                        int recovery);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
+                                        const char *filename,
+                                        int recovery,
+                                        void *data);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlSAXParseEntity       (xmlSAXHandlerPtr sax,
+                                        const char *filename);
+XMLPUBFUN xmlDocPtr XMLCALL    
+               xmlParseEntity          (const char *filename);
+#endif /* LIBXML_SAX1_ENABLED */
+
+#ifdef LIBXML_VALID_ENABLED
+XMLPUBFUN xmlDtdPtr XMLCALL    
+               xmlSAXParseDTD          (xmlSAXHandlerPtr sax,
+                                        const xmlChar *ExternalID,
+                                        const xmlChar *SystemID);
+XMLPUBFUN xmlDtdPtr XMLCALL    
+               xmlParseDTD             (const xmlChar *ExternalID,
+                                        const xmlChar *SystemID);
+XMLPUBFUN xmlDtdPtr XMLCALL    
+               xmlIOParseDTD           (xmlSAXHandlerPtr sax,
+                                        xmlParserInputBufferPtr input,
+                                        xmlCharEncoding enc);
+#endif /* LIBXML_VALID_ENABLE */
+#ifdef LIBXML_SAX1_ENABLED
+XMLPUBFUN int XMLCALL  
+               xmlParseBalancedChunkMemory(xmlDocPtr doc,
+                                        xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        int depth,
+                                        const xmlChar *string,
+                                        xmlNodePtr *lst);
+#endif /* LIBXML_SAX1_ENABLED */
+XMLPUBFUN xmlParserErrors XMLCALL
+               xmlParseInNodeContext   (xmlNodePtr node,
+                                        const char *data,
+                                        int datalen,
+                                        int options,
+                                        xmlNodePtr *lst);
+#ifdef LIBXML_SAX1_ENABLED
+XMLPUBFUN int XMLCALL          
+               xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
+                     xmlSAXHandlerPtr sax,
+                     void *user_data,
+                     int depth,
+                     const xmlChar *string,
+                     xmlNodePtr *lst,
+                     int recover);
+XMLPUBFUN int XMLCALL          
+               xmlParseExternalEntity  (xmlDocPtr doc,
+                                        xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        int depth,
+                                        const xmlChar *URL,
+                                        const xmlChar *ID,
+                                        xmlNodePtr *lst);
+#endif /* LIBXML_SAX1_ENABLED */
+XMLPUBFUN int XMLCALL          
+               xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
+                                        const xmlChar *URL,
+                                        const xmlChar *ID,
+                                        xmlNodePtr *lst);
+
+/*
+ * Parser contexts handling.
+ */
+XMLPUBFUN xmlParserCtxtPtr XMLCALL     
+               xmlNewParserCtxt        (void);
+XMLPUBFUN int XMLCALL          
+               xmlInitParserCtxt       (xmlParserCtxtPtr ctxt);
+XMLPUBFUN void XMLCALL         
+               xmlClearParserCtxt      (xmlParserCtxtPtr ctxt);
+XMLPUBFUN void XMLCALL         
+               xmlFreeParserCtxt       (xmlParserCtxtPtr ctxt);
+#ifdef LIBXML_SAX1_ENABLED
+XMLPUBFUN void XMLCALL         
+               xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
+                                        const xmlChar* buffer,
+                                        const char *filename);
+#endif /* LIBXML_SAX1_ENABLED */
+XMLPUBFUN xmlParserCtxtPtr XMLCALL 
+               xmlCreateDocParserCtxt  (const xmlChar *cur);
+
+#ifdef LIBXML_LEGACY_ENABLED
+/*
+ * Reading/setting optional parsing features.
+ */
+XMLPUBFUN int XMLCALL          
+               xmlGetFeaturesList      (int *len,
+                                        const char **result);
+XMLPUBFUN int XMLCALL          
+               xmlGetFeature           (xmlParserCtxtPtr ctxt,
+                                        const char *name,
+                                        void *result);
+XMLPUBFUN int XMLCALL          
+               xmlSetFeature           (xmlParserCtxtPtr ctxt,
+                                        const char *name,
+                                        void *value);
+#endif /* LIBXML_LEGACY_ENABLED */
+
+#ifdef LIBXML_PUSH_ENABLED
+/*
+ * Interfaces for the Push mode.
+ */
+XMLPUBFUN xmlParserCtxtPtr XMLCALL 
+               xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        const char *chunk,
+                                        int size,
+                                        const char *filename);
+XMLPUBFUN int XMLCALL           
+               xmlParseChunk           (xmlParserCtxtPtr ctxt,
+                                        const char *chunk,
+                                        int size,
+                                        int terminate);
+#endif /* LIBXML_PUSH_ENABLED */
+
+/*
+ * Special I/O mode.
+ */
+
+XMLPUBFUN xmlParserCtxtPtr XMLCALL 
+               xmlCreateIOParserCtxt   (xmlSAXHandlerPtr sax,
+                                        void *user_data,
+                                        xmlInputReadCallback   ioread,
+                                        xmlInputCloseCallback  ioclose,
+                                        void *ioctx,
+                                        xmlCharEncoding enc);
+
+XMLPUBFUN xmlParserInputPtr XMLCALL 
+               xmlNewIOInputStream     (xmlParserCtxtPtr ctxt,
+                                        xmlParserInputBufferPtr input,
+                                        xmlCharEncoding enc);
+
+/*
+ * Node infos.
+ */
+XMLPUBFUN const xmlParserNodeInfo* XMLCALL
+               xmlParserFindNodeInfo   (const xmlParserCtxtPtr ctxt,
+                                        const xmlNodePtr node);
+XMLPUBFUN void XMLCALL         
+               xmlInitNodeInfoSeq      (xmlParserNodeInfoSeqPtr seq);
+XMLPUBFUN void XMLCALL         
+               xmlClearNodeInfoSeq     (xmlParserNodeInfoSeqPtr seq);
+XMLPUBFUN unsigned long XMLCALL 
+               xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
+                                         const xmlNodePtr node);
+XMLPUBFUN void XMLCALL         
+               xmlParserAddNodeInfo    (xmlParserCtxtPtr ctxt,
+                                        const xmlParserNodeInfoPtr info);
+
+/*
+ * External entities handling actually implemented in xmlIO.
+ */
+
+XMLPUBFUN void XMLCALL         
+               xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
+XMLPUBFUN xmlExternalEntityLoader XMLCALL
+               xmlGetExternalEntityLoader(void);
+XMLPUBFUN xmlParserInputPtr XMLCALL
+               xmlLoadExternalEntity   (const char *URL,
+                                        const char *ID,
+                                        xmlParserCtxtPtr ctxt);
+
+/*
+ * Index lookup, actually implemented in the encoding module
+ */
+XMLPUBFUN long XMLCALL
+               xmlByteConsumed         (xmlParserCtxtPtr ctxt);
+
+/*
+ * New set of simpler/more flexible APIs
+ */
+/**
+ * xmlParserOption:
+ *
+ * This is the set of XML parser options that can be passed down
+ * to the xmlReadDoc() and similar calls.
+ */
+typedef enum {
+    XML_PARSE_RECOVER  = 1<<0, /* recover on errors */
+    XML_PARSE_NOENT    = 1<<1, /* substitute entities */
+    XML_PARSE_DTDLOAD  = 1<<2, /* load the external subset */
+    XML_PARSE_DTDATTR  = 1<<3, /* default DTD attributes */
+    XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
+    XML_PARSE_NOERROR  = 1<<5, /* suppress error reports */
+    XML_PARSE_NOWARNING        = 1<<6, /* suppress warning reports */
+    XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
+    XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
+    XML_PARSE_SAX1     = 1<<9, /* use the SAX1 interface internally */
+    XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition  */
+    XML_PARSE_NONET    = 1<<11,/* Forbid network access */
+    XML_PARSE_NODICT   = 1<<12,/* Do not reuse the context dictionnary */
+    XML_PARSE_NSCLEAN  = 1<<13,/* remove redundant namespaces declarations */
+    XML_PARSE_NOCDATA  = 1<<14,/* merge CDATA as text nodes */
+    XML_PARSE_NOXINCNODE= 1<<15 /* do not generate XINCLUDE START/END nodes */
+} xmlParserOption;
+
+XMLPUBFUN void XMLCALL
+               xmlCtxtReset            (xmlParserCtxtPtr ctxt);
+XMLPUBFUN int XMLCALL
+               xmlCtxtResetPush        (xmlParserCtxtPtr ctxt,
+                                        const char *chunk,
+                                        int size,
+                                        const char *filename,
+                                        const char *encoding);
+XMLPUBFUN int XMLCALL
+               xmlCtxtUseOptions       (xmlParserCtxtPtr ctxt,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlReadDoc              (const xmlChar *cur,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlReadFile             (const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlReadMemory           (const char *buffer,
+                                        int size,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlReadFd               (int fd,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlReadIO               (xmlInputReadCallback ioread,
+                                        xmlInputCloseCallback ioclose,
+                                        void *ioctx,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlCtxtReadDoc          (xmlParserCtxtPtr ctxt,
+                                        const xmlChar *cur,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlCtxtReadFile         (xmlParserCtxtPtr ctxt,
+                                        const char *filename,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlCtxtReadMemory               (xmlParserCtxtPtr ctxt,
+                                        const char *buffer,
+                                        int size,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlCtxtReadFd           (xmlParserCtxtPtr ctxt,
+                                        int fd,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+XMLPUBFUN xmlDocPtr XMLCALL
+               xmlCtxtReadIO           (xmlParserCtxtPtr ctxt,
+                                        xmlInputReadCallback ioread,
+                                        xmlInputCloseCallback ioclose,
+                                        void *ioctx,
+                                        const char *URL,
+                                        const char *encoding,
+                                        int options);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_PARSER_H__ */
+