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