parser/expat/lib/expat.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/expat/lib/expat.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1018 @@
     1.4 +/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
     1.5 +   See the file COPYING for copying permission.
     1.6 +*/
     1.7 +
     1.8 +#ifndef Expat_INCLUDED
     1.9 +#define Expat_INCLUDED 1
    1.10 +
    1.11 +#ifdef __VMS
    1.12 +/*      0        1         2         3      0        1         2         3
    1.13 +        1234567890123456789012345678901     1234567890123456789012345678901 */
    1.14 +#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
    1.15 +#define XML_SetUnparsedEntityDeclHandler    XML_SetUnparsedEntDeclHandler
    1.16 +#define XML_SetStartNamespaceDeclHandler    XML_SetStartNamespcDeclHandler
    1.17 +#define XML_SetExternalEntityRefHandlerArg  XML_SetExternalEntRefHandlerArg
    1.18 +#endif
    1.19 +
    1.20 +#include <stdlib.h>
    1.21 +#include "expat_external.h"
    1.22 +
    1.23 +#ifdef __cplusplus
    1.24 +extern "C" {
    1.25 +#endif
    1.26 +
    1.27 +struct XML_ParserStruct;
    1.28 +typedef struct XML_ParserStruct *XML_Parser;
    1.29 +
    1.30 +/* Should this be defined using stdbool.h when C99 is available? */
    1.31 +typedef unsigned char XML_Bool;
    1.32 +#define XML_TRUE   ((XML_Bool) 1)
    1.33 +#define XML_FALSE  ((XML_Bool) 0)
    1.34 +
    1.35 +/* The XML_Status enum gives the possible return values for several
    1.36 +   API functions.  The preprocessor #defines are included so this
    1.37 +   stanza can be added to code that still needs to support older
    1.38 +   versions of Expat 1.95.x:
    1.39 +
    1.40 +   #ifndef XML_STATUS_OK
    1.41 +   #define XML_STATUS_OK    1
    1.42 +   #define XML_STATUS_ERROR 0
    1.43 +   #endif
    1.44 +
    1.45 +   Otherwise, the #define hackery is quite ugly and would have been
    1.46 +   dropped.
    1.47 +*/
    1.48 +enum XML_Status {
    1.49 +  XML_STATUS_ERROR = 0,
    1.50 +#define XML_STATUS_ERROR XML_STATUS_ERROR
    1.51 +  XML_STATUS_OK = 1,
    1.52 +#define XML_STATUS_OK XML_STATUS_OK
    1.53 +  XML_STATUS_SUSPENDED = 2
    1.54 +#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
    1.55 +};
    1.56 +
    1.57 +enum XML_Error {
    1.58 +  XML_ERROR_NONE,
    1.59 +  XML_ERROR_NO_MEMORY,
    1.60 +  XML_ERROR_SYNTAX,
    1.61 +  XML_ERROR_NO_ELEMENTS,
    1.62 +  XML_ERROR_INVALID_TOKEN,
    1.63 +  XML_ERROR_UNCLOSED_TOKEN,
    1.64 +  XML_ERROR_PARTIAL_CHAR,
    1.65 +  XML_ERROR_TAG_MISMATCH,
    1.66 +  XML_ERROR_DUPLICATE_ATTRIBUTE,
    1.67 +  XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
    1.68 +  XML_ERROR_PARAM_ENTITY_REF,
    1.69 +  XML_ERROR_UNDEFINED_ENTITY,
    1.70 +  XML_ERROR_RECURSIVE_ENTITY_REF,
    1.71 +  XML_ERROR_ASYNC_ENTITY,
    1.72 +  XML_ERROR_BAD_CHAR_REF,
    1.73 +  XML_ERROR_BINARY_ENTITY_REF,
    1.74 +  XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
    1.75 +  XML_ERROR_MISPLACED_XML_PI,
    1.76 +  XML_ERROR_UNKNOWN_ENCODING,
    1.77 +  XML_ERROR_INCORRECT_ENCODING,
    1.78 +  XML_ERROR_UNCLOSED_CDATA_SECTION,
    1.79 +  XML_ERROR_EXTERNAL_ENTITY_HANDLING,
    1.80 +  XML_ERROR_NOT_STANDALONE,
    1.81 +  XML_ERROR_UNEXPECTED_STATE,
    1.82 +  XML_ERROR_ENTITY_DECLARED_IN_PE,
    1.83 +  XML_ERROR_FEATURE_REQUIRES_XML_DTD,
    1.84 +  XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
    1.85 +  /* Added in 1.95.7. */
    1.86 +  XML_ERROR_UNBOUND_PREFIX,
    1.87 +  /* Added in 1.95.8. */
    1.88 +  XML_ERROR_UNDECLARING_PREFIX,
    1.89 +  XML_ERROR_INCOMPLETE_PE,
    1.90 +  XML_ERROR_XML_DECL,
    1.91 +  XML_ERROR_TEXT_DECL,
    1.92 +  XML_ERROR_PUBLICID,
    1.93 +  XML_ERROR_SUSPENDED,
    1.94 +  XML_ERROR_NOT_SUSPENDED,
    1.95 +  XML_ERROR_ABORTED,
    1.96 +  XML_ERROR_FINISHED,
    1.97 +  XML_ERROR_SUSPEND_PE,
    1.98 +  /* Added in 2.0. */
    1.99 +  XML_ERROR_RESERVED_PREFIX_XML,
   1.100 +  XML_ERROR_RESERVED_PREFIX_XMLNS,
   1.101 +  XML_ERROR_RESERVED_NAMESPACE_URI
   1.102 +};
   1.103 +
   1.104 +enum XML_Content_Type {
   1.105 +  XML_CTYPE_EMPTY = 1,
   1.106 +  XML_CTYPE_ANY,
   1.107 +  XML_CTYPE_MIXED,
   1.108 +  XML_CTYPE_NAME,
   1.109 +  XML_CTYPE_CHOICE,
   1.110 +  XML_CTYPE_SEQ
   1.111 +};
   1.112 +
   1.113 +enum XML_Content_Quant {
   1.114 +  XML_CQUANT_NONE,
   1.115 +  XML_CQUANT_OPT,
   1.116 +  XML_CQUANT_REP,
   1.117 +  XML_CQUANT_PLUS
   1.118 +};
   1.119 +
   1.120 +/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
   1.121 +   XML_CQUANT_NONE, and the other fields will be zero or NULL.
   1.122 +   If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
   1.123 +   numchildren will contain number of elements that may be mixed in
   1.124 +   and children point to an array of XML_Content cells that will be
   1.125 +   all of XML_CTYPE_NAME type with no quantification.
   1.126 +
   1.127 +   If type == XML_CTYPE_NAME, then the name points to the name, and
   1.128 +   the numchildren field will be zero and children will be NULL. The
   1.129 +   quant fields indicates any quantifiers placed on the name.
   1.130 +
   1.131 +   CHOICE and SEQ will have name NULL, the number of children in
   1.132 +   numchildren and children will point, recursively, to an array
   1.133 +   of XML_Content cells.
   1.134 +
   1.135 +   The EMPTY, ANY, and MIXED types will only occur at top level.
   1.136 +*/
   1.137 +
   1.138 +typedef struct XML_cp XML_Content;
   1.139 +
   1.140 +struct XML_cp {
   1.141 +  enum XML_Content_Type         type;
   1.142 +  enum XML_Content_Quant        quant;
   1.143 +  XML_Char *                    name;
   1.144 +  unsigned int                  numchildren;
   1.145 +  XML_Content *                 children;
   1.146 +};
   1.147 +
   1.148 +
   1.149 +/* This is called for an element declaration. See above for
   1.150 +   description of the model argument. It's the caller's responsibility
   1.151 +   to free model when finished with it.
   1.152 +*/
   1.153 +typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,
   1.154 +                                                const XML_Char *name,
   1.155 +                                                XML_Content *model);
   1.156 +
   1.157 +XMLPARSEAPI(void)
   1.158 +XML_SetElementDeclHandler(XML_Parser parser,
   1.159 +                          XML_ElementDeclHandler eldecl);
   1.160 +
   1.161 +/* The Attlist declaration handler is called for *each* attribute. So
   1.162 +   a single Attlist declaration with multiple attributes declared will
   1.163 +   generate multiple calls to this handler. The "default" parameter
   1.164 +   may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
   1.165 +   keyword. The "isrequired" parameter will be true and the default
   1.166 +   value will be NULL in the case of "#REQUIRED". If "isrequired" is
   1.167 +   true and default is non-NULL, then this is a "#FIXED" default.
   1.168 +*/
   1.169 +typedef void (XMLCALL *XML_AttlistDeclHandler) (
   1.170 +                                    void            *userData,
   1.171 +                                    const XML_Char  *elname,
   1.172 +                                    const XML_Char  *attname,
   1.173 +                                    const XML_Char  *att_type,
   1.174 +                                    const XML_Char  *dflt,
   1.175 +                                    int              isrequired);
   1.176 +
   1.177 +XMLPARSEAPI(void)
   1.178 +XML_SetAttlistDeclHandler(XML_Parser parser,
   1.179 +                          XML_AttlistDeclHandler attdecl);
   1.180 +
   1.181 +/* The XML declaration handler is called for *both* XML declarations
   1.182 +   and text declarations. The way to distinguish is that the version
   1.183 +   parameter will be NULL for text declarations. The encoding
   1.184 +   parameter may be NULL for XML declarations. The standalone
   1.185 +   parameter will be -1, 0, or 1 indicating respectively that there
   1.186 +   was no standalone parameter in the declaration, that it was given
   1.187 +   as no, or that it was given as yes.
   1.188 +*/
   1.189 +typedef void (XMLCALL *XML_XmlDeclHandler) (void           *userData,
   1.190 +                                            const XML_Char *version,
   1.191 +                                            const XML_Char *encoding,
   1.192 +                                            int             standalone);
   1.193 +
   1.194 +XMLPARSEAPI(void)
   1.195 +XML_SetXmlDeclHandler(XML_Parser parser,
   1.196 +                      XML_XmlDeclHandler xmldecl);
   1.197 +
   1.198 +
   1.199 +typedef struct {
   1.200 +  void *(*malloc_fcn)(size_t size);
   1.201 +  void *(*realloc_fcn)(void *ptr, size_t size);
   1.202 +  void (*free_fcn)(void *ptr);
   1.203 +} XML_Memory_Handling_Suite;
   1.204 +
   1.205 +/* Constructs a new parser; encoding is the encoding specified by the
   1.206 +   external protocol or NULL if there is none specified.
   1.207 +*/
   1.208 +XMLPARSEAPI(XML_Parser)
   1.209 +XML_ParserCreate(const XML_Char *encoding);
   1.210 +
   1.211 +/* Constructs a new parser and namespace processor.  Element type
   1.212 +   names and attribute names that belong to a namespace will be
   1.213 +   expanded; unprefixed attribute names are never expanded; unprefixed
   1.214 +   element type names are expanded only if there is a default
   1.215 +   namespace. The expanded name is the concatenation of the namespace
   1.216 +   URI, the namespace separator character, and the local part of the
   1.217 +   name.  If the namespace separator is '\0' then the namespace URI
   1.218 +   and the local part will be concatenated without any separator.
   1.219 +   It is a programming error to use the separator '\0' with namespace
   1.220 +   triplets (see XML_SetReturnNSTriplet).
   1.221 +*/
   1.222 +XMLPARSEAPI(XML_Parser)
   1.223 +XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
   1.224 +
   1.225 +
   1.226 +/* Constructs a new parser using the memory management suite referred to
   1.227 +   by memsuite. If memsuite is NULL, then use the standard library memory
   1.228 +   suite. If namespaceSeparator is non-NULL it creates a parser with
   1.229 +   namespace processing as described above. The character pointed at
   1.230 +   will serve as the namespace separator.
   1.231 +
   1.232 +   All further memory operations used for the created parser will come from
   1.233 +   the given suite.
   1.234 +*/
   1.235 +XMLPARSEAPI(XML_Parser)
   1.236 +XML_ParserCreate_MM(const XML_Char *encoding,
   1.237 +                    const XML_Memory_Handling_Suite *memsuite,
   1.238 +                    const XML_Char *namespaceSeparator);
   1.239 +
   1.240 +/* Prepare a parser object to be re-used.  This is particularly
   1.241 +   valuable when memory allocation overhead is disproportionatly high,
   1.242 +   such as when a large number of small documnents need to be parsed.
   1.243 +   All handlers are cleared from the parser, except for the
   1.244 +   unknownEncodingHandler. The parser's external state is re-initialized
   1.245 +   except for the values of ns and ns_triplets.
   1.246 +
   1.247 +   Added in Expat 1.95.3.
   1.248 +*/
   1.249 +XMLPARSEAPI(XML_Bool)
   1.250 +XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
   1.251 +
   1.252 +/* atts is array of name/value pairs, terminated by 0;
   1.253 +   names and values are 0 terminated.
   1.254 +*/
   1.255 +typedef void (XMLCALL *XML_StartElementHandler) (void *userData,
   1.256 +                                                 const XML_Char *name,
   1.257 +                                                 const XML_Char **atts);
   1.258 +
   1.259 +typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
   1.260 +                                               const XML_Char *name);
   1.261 +
   1.262 +
   1.263 +/* s is not 0 terminated. */
   1.264 +typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,
   1.265 +                                                  const XML_Char *s,
   1.266 +                                                  int len);
   1.267 +
   1.268 +/* target and data are 0 terminated */
   1.269 +typedef void (XMLCALL *XML_ProcessingInstructionHandler) (
   1.270 +                                                void *userData,
   1.271 +                                                const XML_Char *target,
   1.272 +                                                const XML_Char *data);
   1.273 +
   1.274 +/* data is 0 terminated */
   1.275 +typedef void (XMLCALL *XML_CommentHandler) (void *userData,
   1.276 +                                            const XML_Char *data);
   1.277 +
   1.278 +typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData);
   1.279 +typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
   1.280 +
   1.281 +/* This is called for any characters in the XML document for which
   1.282 +   there is no applicable handler.  This includes both characters that
   1.283 +   are part of markup which is of a kind that is not reported
   1.284 +   (comments, markup declarations), or characters that are part of a
   1.285 +   construct which could be reported but for which no handler has been
   1.286 +   supplied. The characters are passed exactly as they were in the XML
   1.287 +   document except that they will be encoded in UTF-8 or UTF-16.
   1.288 +   Line boundaries are not normalized. Note that a byte order mark
   1.289 +   character is not passed to the default handler. There are no
   1.290 +   guarantees about how characters are divided between calls to the
   1.291 +   default handler: for example, a comment might be split between
   1.292 +   multiple calls.
   1.293 +*/
   1.294 +typedef void (XMLCALL *XML_DefaultHandler) (void *userData,
   1.295 +                                            const XML_Char *s,
   1.296 +                                            int len);
   1.297 +
   1.298 +/* This is called for the start of the DOCTYPE declaration, before
   1.299 +   any DTD or internal subset is parsed.
   1.300 +*/
   1.301 +typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
   1.302 +                                            void *userData,
   1.303 +                                            const XML_Char *doctypeName,
   1.304 +                                            const XML_Char *sysid,
   1.305 +                                            const XML_Char *pubid,
   1.306 +                                            int has_internal_subset);
   1.307 +
   1.308 +/* This is called for the start of the DOCTYPE declaration when the
   1.309 +   closing > is encountered, but after processing any external
   1.310 +   subset.
   1.311 +*/
   1.312 +typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
   1.313 +
   1.314 +/* This is called for entity declarations. The is_parameter_entity
   1.315 +   argument will be non-zero if the entity is a parameter entity, zero
   1.316 +   otherwise.
   1.317 +
   1.318 +   For internal entities (<!ENTITY foo "bar">), value will
   1.319 +   be non-NULL and systemId, publicID, and notationName will be NULL.
   1.320 +   The value string is NOT nul-terminated; the length is provided in
   1.321 +   the value_length argument. Since it is legal to have zero-length
   1.322 +   values, do not use this argument to test for internal entities.
   1.323 +
   1.324 +   For external entities, value will be NULL and systemId will be
   1.325 +   non-NULL. The publicId argument will be NULL unless a public
   1.326 +   identifier was provided. The notationName argument will have a
   1.327 +   non-NULL value only for unparsed entity declarations.
   1.328 +
   1.329 +   Note that is_parameter_entity can't be changed to XML_Bool, since
   1.330 +   that would break binary compatibility.
   1.331 +*/
   1.332 +typedef void (XMLCALL *XML_EntityDeclHandler) (
   1.333 +                              void *userData,
   1.334 +                              const XML_Char *entityName,
   1.335 +                              int is_parameter_entity,
   1.336 +                              const XML_Char *value,
   1.337 +                              int value_length,
   1.338 +                              const XML_Char *base,
   1.339 +                              const XML_Char *systemId,
   1.340 +                              const XML_Char *publicId,
   1.341 +                              const XML_Char *notationName);
   1.342 +
   1.343 +XMLPARSEAPI(void)
   1.344 +XML_SetEntityDeclHandler(XML_Parser parser,
   1.345 +                         XML_EntityDeclHandler handler);
   1.346 +
   1.347 +/* OBSOLETE -- OBSOLETE -- OBSOLETE
   1.348 +   This handler has been superseded by the EntityDeclHandler above.
   1.349 +   It is provided here for backward compatibility.
   1.350 +
   1.351 +   This is called for a declaration of an unparsed (NDATA) entity.
   1.352 +   The base argument is whatever was set by XML_SetBase. The
   1.353 +   entityName, systemId and notationName arguments will never be
   1.354 +   NULL. The other arguments may be.
   1.355 +*/
   1.356 +typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) (
   1.357 +                                    void *userData,
   1.358 +                                    const XML_Char *entityName,
   1.359 +                                    const XML_Char *base,
   1.360 +                                    const XML_Char *systemId,
   1.361 +                                    const XML_Char *publicId,
   1.362 +                                    const XML_Char *notationName);
   1.363 +
   1.364 +/* This is called for a declaration of notation.  The base argument is
   1.365 +   whatever was set by XML_SetBase. The notationName will never be
   1.366 +   NULL.  The other arguments can be.
   1.367 +*/
   1.368 +typedef void (XMLCALL *XML_NotationDeclHandler) (
   1.369 +                                    void *userData,
   1.370 +                                    const XML_Char *notationName,
   1.371 +                                    const XML_Char *base,
   1.372 +                                    const XML_Char *systemId,
   1.373 +                                    const XML_Char *publicId);
   1.374 +
   1.375 +/* When namespace processing is enabled, these are called once for
   1.376 +   each namespace declaration. The call to the start and end element
   1.377 +   handlers occur between the calls to the start and end namespace
   1.378 +   declaration handlers. For an xmlns attribute, prefix will be
   1.379 +   NULL.  For an xmlns="" attribute, uri will be NULL.
   1.380 +*/
   1.381 +typedef void (XMLCALL *XML_StartNamespaceDeclHandler) (
   1.382 +                                    void *userData,
   1.383 +                                    const XML_Char *prefix,
   1.384 +                                    const XML_Char *uri);
   1.385 +
   1.386 +typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
   1.387 +                                    void *userData,
   1.388 +                                    const XML_Char *prefix);
   1.389 +
   1.390 +/* This is called if the document is not standalone, that is, it has an
   1.391 +   external subset or a reference to a parameter entity, but does not
   1.392 +   have standalone="yes". If this handler returns XML_STATUS_ERROR,
   1.393 +   then processing will not continue, and the parser will return a
   1.394 +   XML_ERROR_NOT_STANDALONE error.
   1.395 +   If parameter entity parsing is enabled, then in addition to the
   1.396 +   conditions above this handler will only be called if the referenced
   1.397 +   entity was actually read.
   1.398 +*/
   1.399 +typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
   1.400 +
   1.401 +/* This is called for a reference to an external parsed general
   1.402 +   entity.  The referenced entity is not automatically parsed.  The
   1.403 +   application can parse it immediately or later using
   1.404 +   XML_ExternalEntityParserCreate.
   1.405 +
   1.406 +   The parser argument is the parser parsing the entity containing the
   1.407 +   reference; it can be passed as the parser argument to
   1.408 +   XML_ExternalEntityParserCreate.  The systemId argument is the
   1.409 +   system identifier as specified in the entity declaration; it will
   1.410 +   not be NULL.
   1.411 +
   1.412 +   The base argument is the system identifier that should be used as
   1.413 +   the base for resolving systemId if systemId was relative; this is
   1.414 +   set by XML_SetBase; it may be NULL.
   1.415 +
   1.416 +   The publicId argument is the public identifier as specified in the
   1.417 +   entity declaration, or NULL if none was specified; the whitespace
   1.418 +   in the public identifier will have been normalized as required by
   1.419 +   the XML spec.
   1.420 +
   1.421 +   The context argument specifies the parsing context in the format
   1.422 +   expected by the context argument to XML_ExternalEntityParserCreate;
   1.423 +   context is valid only until the handler returns, so if the
   1.424 +   referenced entity is to be parsed later, it must be copied.
   1.425 +   context is NULL only when the entity is a parameter entity.
   1.426 +
   1.427 +   The handler should return XML_STATUS_ERROR if processing should not
   1.428 +   continue because of a fatal error in the handling of the external
   1.429 +   entity.  In this case the calling parser will return an
   1.430 +   XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
   1.431 +
   1.432 +   Note that unlike other handlers the first argument is the parser,
   1.433 +   not userData.
   1.434 +*/
   1.435 +typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
   1.436 +                                    XML_Parser parser,
   1.437 +                                    const XML_Char *context,
   1.438 +                                    const XML_Char *base,
   1.439 +                                    const XML_Char *systemId,
   1.440 +                                    const XML_Char *publicId);
   1.441 +
   1.442 +/* This is called in two situations:
   1.443 +   1) An entity reference is encountered for which no declaration
   1.444 +      has been read *and* this is not an error.
   1.445 +   2) An internal entity reference is read, but not expanded, because
   1.446 +      XML_SetDefaultHandler has been called.
   1.447 +   Note: skipped parameter entities in declarations and skipped general
   1.448 +         entities in attribute values cannot be reported, because
   1.449 +         the event would be out of sync with the reporting of the
   1.450 +         declarations or attribute values
   1.451 +*/
   1.452 +typedef void (XMLCALL *XML_SkippedEntityHandler) (
   1.453 +                                    void *userData,
   1.454 +                                    const XML_Char *entityName,
   1.455 +                                    int is_parameter_entity);
   1.456 +
   1.457 +/* This structure is filled in by the XML_UnknownEncodingHandler to
   1.458 +   provide information to the parser about encodings that are unknown
   1.459 +   to the parser.
   1.460 +
   1.461 +   The map[b] member gives information about byte sequences whose
   1.462 +   first byte is b.
   1.463 +
   1.464 +   If map[b] is c where c is >= 0, then b by itself encodes the
   1.465 +   Unicode scalar value c.
   1.466 +
   1.467 +   If map[b] is -1, then the byte sequence is malformed.
   1.468 +
   1.469 +   If map[b] is -n, where n >= 2, then b is the first byte of an
   1.470 +   n-byte sequence that encodes a single Unicode scalar value.
   1.471 +
   1.472 +   The data member will be passed as the first argument to the convert
   1.473 +   function.
   1.474 +
   1.475 +   The convert function is used to convert multibyte sequences; s will
   1.476 +   point to a n-byte sequence where map[(unsigned char)*s] == -n.  The
   1.477 +   convert function must return the Unicode scalar value represented
   1.478 +   by this byte sequence or -1 if the byte sequence is malformed.
   1.479 +
   1.480 +   The convert function may be NULL if the encoding is a single-byte
   1.481 +   encoding, that is if map[b] >= -1 for all bytes b.
   1.482 +
   1.483 +   When the parser is finished with the encoding, then if release is
   1.484 +   not NULL, it will call release passing it the data member; once
   1.485 +   release has been called, the convert function will not be called
   1.486 +   again.
   1.487 +
   1.488 +   Expat places certain restrictions on the encodings that are supported
   1.489 +   using this mechanism.
   1.490 +
   1.491 +   1. Every ASCII character that can appear in a well-formed XML document,
   1.492 +      other than the characters
   1.493 +
   1.494 +      $@\^`{}~
   1.495 +
   1.496 +      must be represented by a single byte, and that byte must be the
   1.497 +      same byte that represents that character in ASCII.
   1.498 +
   1.499 +   2. No character may require more than 4 bytes to encode.
   1.500 +
   1.501 +   3. All characters encoded must have Unicode scalar values <=
   1.502 +      0xFFFF, (i.e., characters that would be encoded by surrogates in
   1.503 +      UTF-16 are  not allowed).  Note that this restriction doesn't
   1.504 +      apply to the built-in support for UTF-8 and UTF-16.
   1.505 +
   1.506 +   4. No Unicode character may be encoded by more than one distinct
   1.507 +      sequence of bytes.
   1.508 +*/
   1.509 +typedef struct {
   1.510 +  int map[256];
   1.511 +  void *data;
   1.512 +  int (XMLCALL *convert)(void *data, const char *s);
   1.513 +  void (XMLCALL *release)(void *data);
   1.514 +} XML_Encoding;
   1.515 +
   1.516 +/* This is called for an encoding that is unknown to the parser.
   1.517 +
   1.518 +   The encodingHandlerData argument is that which was passed as the
   1.519 +   second argument to XML_SetUnknownEncodingHandler.
   1.520 +
   1.521 +   The name argument gives the name of the encoding as specified in
   1.522 +   the encoding declaration.
   1.523 +
   1.524 +   If the callback can provide information about the encoding, it must
   1.525 +   fill in the XML_Encoding structure, and return XML_STATUS_OK.
   1.526 +   Otherwise it must return XML_STATUS_ERROR.
   1.527 +
   1.528 +   If info does not describe a suitable encoding, then the parser will
   1.529 +   return an XML_UNKNOWN_ENCODING error.
   1.530 +*/
   1.531 +typedef int (XMLCALL *XML_UnknownEncodingHandler) (
   1.532 +                                    void *encodingHandlerData,
   1.533 +                                    const XML_Char *name,
   1.534 +                                    XML_Encoding *info);
   1.535 +
   1.536 +XMLPARSEAPI(void)
   1.537 +XML_SetElementHandler(XML_Parser parser,
   1.538 +                      XML_StartElementHandler start,
   1.539 +                      XML_EndElementHandler end);
   1.540 +
   1.541 +XMLPARSEAPI(void)
   1.542 +XML_SetStartElementHandler(XML_Parser parser,
   1.543 +                           XML_StartElementHandler handler);
   1.544 +
   1.545 +XMLPARSEAPI(void)
   1.546 +XML_SetEndElementHandler(XML_Parser parser,
   1.547 +                         XML_EndElementHandler handler);
   1.548 +
   1.549 +XMLPARSEAPI(void)
   1.550 +XML_SetCharacterDataHandler(XML_Parser parser,
   1.551 +                            XML_CharacterDataHandler handler);
   1.552 +
   1.553 +XMLPARSEAPI(void)
   1.554 +XML_SetProcessingInstructionHandler(XML_Parser parser,
   1.555 +                                    XML_ProcessingInstructionHandler handler);
   1.556 +XMLPARSEAPI(void)
   1.557 +XML_SetCommentHandler(XML_Parser parser,
   1.558 +                      XML_CommentHandler handler);
   1.559 +
   1.560 +XMLPARSEAPI(void)
   1.561 +XML_SetCdataSectionHandler(XML_Parser parser,
   1.562 +                           XML_StartCdataSectionHandler start,
   1.563 +                           XML_EndCdataSectionHandler end);
   1.564 +
   1.565 +XMLPARSEAPI(void)
   1.566 +XML_SetStartCdataSectionHandler(XML_Parser parser,
   1.567 +                                XML_StartCdataSectionHandler start);
   1.568 +
   1.569 +XMLPARSEAPI(void)
   1.570 +XML_SetEndCdataSectionHandler(XML_Parser parser,
   1.571 +                              XML_EndCdataSectionHandler end);
   1.572 +
   1.573 +/* This sets the default handler and also inhibits expansion of
   1.574 +   internal entities. These entity references will be passed to the
   1.575 +   default handler, or to the skipped entity handler, if one is set.
   1.576 +*/
   1.577 +XMLPARSEAPI(void)
   1.578 +XML_SetDefaultHandler(XML_Parser parser,
   1.579 +                      XML_DefaultHandler handler);
   1.580 +
   1.581 +/* This sets the default handler but does not inhibit expansion of
   1.582 +   internal entities.  The entity reference will not be passed to the
   1.583 +   default handler.
   1.584 +*/
   1.585 +XMLPARSEAPI(void)
   1.586 +XML_SetDefaultHandlerExpand(XML_Parser parser,
   1.587 +                            XML_DefaultHandler handler);
   1.588 +
   1.589 +XMLPARSEAPI(void)
   1.590 +XML_SetDoctypeDeclHandler(XML_Parser parser,
   1.591 +                          XML_StartDoctypeDeclHandler start,
   1.592 +                          XML_EndDoctypeDeclHandler end);
   1.593 +
   1.594 +XMLPARSEAPI(void)
   1.595 +XML_SetStartDoctypeDeclHandler(XML_Parser parser,
   1.596 +                               XML_StartDoctypeDeclHandler start);
   1.597 +
   1.598 +XMLPARSEAPI(void)
   1.599 +XML_SetEndDoctypeDeclHandler(XML_Parser parser,
   1.600 +                             XML_EndDoctypeDeclHandler end);
   1.601 +
   1.602 +XMLPARSEAPI(void)
   1.603 +XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
   1.604 +                                 XML_UnparsedEntityDeclHandler handler);
   1.605 +
   1.606 +XMLPARSEAPI(void)
   1.607 +XML_SetNotationDeclHandler(XML_Parser parser,
   1.608 +                           XML_NotationDeclHandler handler);
   1.609 +
   1.610 +XMLPARSEAPI(void)
   1.611 +XML_SetNamespaceDeclHandler(XML_Parser parser,
   1.612 +                            XML_StartNamespaceDeclHandler start,
   1.613 +                            XML_EndNamespaceDeclHandler end);
   1.614 +
   1.615 +XMLPARSEAPI(void)
   1.616 +XML_SetStartNamespaceDeclHandler(XML_Parser parser,
   1.617 +                                 XML_StartNamespaceDeclHandler start);
   1.618 +
   1.619 +XMLPARSEAPI(void)
   1.620 +XML_SetEndNamespaceDeclHandler(XML_Parser parser,
   1.621 +                               XML_EndNamespaceDeclHandler end);
   1.622 +
   1.623 +XMLPARSEAPI(void)
   1.624 +XML_SetNotStandaloneHandler(XML_Parser parser,
   1.625 +                            XML_NotStandaloneHandler handler);
   1.626 +
   1.627 +XMLPARSEAPI(void)
   1.628 +XML_SetExternalEntityRefHandler(XML_Parser parser,
   1.629 +                                XML_ExternalEntityRefHandler handler);
   1.630 +
   1.631 +/* If a non-NULL value for arg is specified here, then it will be
   1.632 +   passed as the first argument to the external entity ref handler
   1.633 +   instead of the parser object.
   1.634 +*/
   1.635 +XMLPARSEAPI(void)
   1.636 +XML_SetExternalEntityRefHandlerArg(XML_Parser parser,
   1.637 +                                   void *arg);
   1.638 +
   1.639 +XMLPARSEAPI(void)
   1.640 +XML_SetSkippedEntityHandler(XML_Parser parser,
   1.641 +                            XML_SkippedEntityHandler handler);
   1.642 +
   1.643 +XMLPARSEAPI(void)
   1.644 +XML_SetUnknownEncodingHandler(XML_Parser parser,
   1.645 +                              XML_UnknownEncodingHandler handler,
   1.646 +                              void *encodingHandlerData);
   1.647 +
   1.648 +/* This can be called within a handler for a start element, end
   1.649 +   element, processing instruction or character data.  It causes the
   1.650 +   corresponding markup to be passed to the default handler.
   1.651 +*/
   1.652 +XMLPARSEAPI(void)
   1.653 +XML_DefaultCurrent(XML_Parser parser);
   1.654 +
   1.655 +/* If do_nst is non-zero, and namespace processing is in effect, and
   1.656 +   a name has a prefix (i.e. an explicit namespace qualifier) then
   1.657 +   that name is returned as a triplet in a single string separated by
   1.658 +   the separator character specified when the parser was created: URI
   1.659 +   + sep + local_name + sep + prefix.
   1.660 +
   1.661 +   If do_nst is zero, then namespace information is returned in the
   1.662 +   default manner (URI + sep + local_name) whether or not the name
   1.663 +   has a prefix.
   1.664 +
   1.665 +   Note: Calling XML_SetReturnNSTriplet after XML_Parse or
   1.666 +     XML_ParseBuffer has no effect.
   1.667 +*/
   1.668 +
   1.669 +XMLPARSEAPI(void)
   1.670 +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
   1.671 +
   1.672 +/* This value is passed as the userData argument to callbacks. */
   1.673 +XMLPARSEAPI(void)
   1.674 +XML_SetUserData(XML_Parser parser, void *userData);
   1.675 +
   1.676 +/* Returns the last value set by XML_SetUserData or NULL. */
   1.677 +#define XML_GetUserData(parser) (*(void **)(parser))
   1.678 +
   1.679 +/* This is equivalent to supplying an encoding argument to
   1.680 +   XML_ParserCreate. On success XML_SetEncoding returns non-zero,
   1.681 +   zero otherwise.
   1.682 +   Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
   1.683 +     has no effect and returns XML_STATUS_ERROR.
   1.684 +*/
   1.685 +XMLPARSEAPI(enum XML_Status)
   1.686 +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
   1.687 +
   1.688 +/* If this function is called, then the parser will be passed as the
   1.689 +   first argument to callbacks instead of userData.  The userData will
   1.690 +   still be accessible using XML_GetUserData.
   1.691 +*/
   1.692 +XMLPARSEAPI(void)
   1.693 +XML_UseParserAsHandlerArg(XML_Parser parser);
   1.694 +
   1.695 +/* If useDTD == XML_TRUE is passed to this function, then the parser
   1.696 +   will assume that there is an external subset, even if none is
   1.697 +   specified in the document. In such a case the parser will call the
   1.698 +   externalEntityRefHandler with a value of NULL for the systemId
   1.699 +   argument (the publicId and context arguments will be NULL as well).
   1.700 +   Note: For the purpose of checking WFC: Entity Declared, passing
   1.701 +     useDTD == XML_TRUE will make the parser behave as if the document
   1.702 +     had a DTD with an external subset.
   1.703 +   Note: If this function is called, then this must be done before
   1.704 +     the first call to XML_Parse or XML_ParseBuffer, since it will
   1.705 +     have no effect after that.  Returns
   1.706 +     XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
   1.707 +   Note: If the document does not have a DOCTYPE declaration at all,
   1.708 +     then startDoctypeDeclHandler and endDoctypeDeclHandler will not
   1.709 +     be called, despite an external subset being parsed.
   1.710 +   Note: If XML_DTD is not defined when Expat is compiled, returns
   1.711 +     XML_ERROR_FEATURE_REQUIRES_XML_DTD.
   1.712 +*/
   1.713 +XMLPARSEAPI(enum XML_Error)
   1.714 +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
   1.715 +
   1.716 +
   1.717 +/* Sets the base to be used for resolving relative URIs in system
   1.718 +   identifiers in declarations.  Resolving relative identifiers is
   1.719 +   left to the application: this value will be passed through as the
   1.720 +   base argument to the XML_ExternalEntityRefHandler,
   1.721 +   XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
   1.722 +   argument will be copied.  Returns XML_STATUS_ERROR if out of memory,
   1.723 +   XML_STATUS_OK otherwise.
   1.724 +*/
   1.725 +XMLPARSEAPI(enum XML_Status)
   1.726 +XML_SetBase(XML_Parser parser, const XML_Char *base);
   1.727 +
   1.728 +XMLPARSEAPI(const XML_Char *)
   1.729 +XML_GetBase(XML_Parser parser);
   1.730 +
   1.731 +/* Returns the number of the attribute/value pairs passed in last call
   1.732 +   to the XML_StartElementHandler that were specified in the start-tag
   1.733 +   rather than defaulted. Each attribute/value pair counts as 2; thus
   1.734 +   this correspondds to an index into the atts array passed to the
   1.735 +   XML_StartElementHandler.
   1.736 +*/
   1.737 +XMLPARSEAPI(int)
   1.738 +XML_GetSpecifiedAttributeCount(XML_Parser parser);
   1.739 +
   1.740 +/* Returns the index of the ID attribute passed in the last call to
   1.741 +   XML_StartElementHandler, or -1 if there is no ID attribute.  Each
   1.742 +   attribute/value pair counts as 2; thus this correspondds to an
   1.743 +   index into the atts array passed to the XML_StartElementHandler.
   1.744 +*/
   1.745 +XMLPARSEAPI(int)
   1.746 +XML_GetIdAttributeIndex(XML_Parser parser);
   1.747 +
   1.748 +/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
   1.749 +   detected.  The last call to XML_Parse must have isFinal true; len
   1.750 +   may be zero for this call (or any other).
   1.751 +
   1.752 +   Though the return values for these functions has always been
   1.753 +   described as a Boolean value, the implementation, at least for the
   1.754 +   1.95.x series, has always returned exactly one of the XML_Status
   1.755 +   values.
   1.756 +*/
   1.757 +XMLPARSEAPI(enum XML_Status)
   1.758 +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
   1.759 +
   1.760 +XMLPARSEAPI(void *)
   1.761 +XML_GetBuffer(XML_Parser parser, int len);
   1.762 +
   1.763 +XMLPARSEAPI(enum XML_Status)
   1.764 +XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
   1.765 +
   1.766 +/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
   1.767 +   Must be called from within a call-back handler, except when aborting
   1.768 +   (resumable = 0) an already suspended parser. Some call-backs may
   1.769 +   still follow because they would otherwise get lost. Examples:
   1.770 +   - endElementHandler() for empty elements when stopped in
   1.771 +     startElementHandler(), 
   1.772 +   - endNameSpaceDeclHandler() when stopped in endElementHandler(), 
   1.773 +   and possibly others.
   1.774 +
   1.775 +   Can be called from most handlers, including DTD related call-backs,
   1.776 +   except when parsing an external parameter entity and resumable != 0.
   1.777 +   Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
   1.778 +   Possible error codes: 
   1.779 +   - XML_ERROR_SUSPENDED: when suspending an already suspended parser.
   1.780 +   - XML_ERROR_FINISHED: when the parser has already finished.
   1.781 +   - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
   1.782 +
   1.783 +   When resumable != 0 (true) then parsing is suspended, that is, 
   1.784 +   XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. 
   1.785 +   Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
   1.786 +   return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
   1.787 +
   1.788 +   *Note*:
   1.789 +   This will be applied to the current parser instance only, that is, if
   1.790 +   there is a parent parser then it will continue parsing when the
   1.791 +   externalEntityRefHandler() returns. It is up to the implementation of
   1.792 +   the externalEntityRefHandler() to call XML_StopParser() on the parent
   1.793 +   parser (recursively), if one wants to stop parsing altogether.
   1.794 +
   1.795 +   When suspended, parsing can be resumed by calling XML_ResumeParser(). 
   1.796 +*/
   1.797 +XMLPARSEAPI(enum XML_Status)
   1.798 +XML_StopParser(XML_Parser parser, XML_Bool resumable);
   1.799 +
   1.800 +/* Resumes parsing after it has been suspended with XML_StopParser().
   1.801 +   Must not be called from within a handler call-back. Returns same
   1.802 +   status codes as XML_Parse() or XML_ParseBuffer().
   1.803 +   Additional error code XML_ERROR_NOT_SUSPENDED possible.   
   1.804 +
   1.805 +   *Note*:
   1.806 +   This must be called on the most deeply nested child parser instance
   1.807 +   first, and on its parent parser only after the child parser has finished,
   1.808 +   to be applied recursively until the document entity's parser is restarted.
   1.809 +   That is, the parent parser will not resume by itself and it is up to the
   1.810 +   application to call XML_ResumeParser() on it at the appropriate moment.
   1.811 +*/
   1.812 +XMLPARSEAPI(enum XML_Status)
   1.813 +XML_ResumeParser(XML_Parser parser);
   1.814 +
   1.815 +enum XML_Parsing {
   1.816 +  XML_INITIALIZED,
   1.817 +  XML_PARSING,
   1.818 +  XML_FINISHED,
   1.819 +  XML_SUSPENDED
   1.820 +};
   1.821 +
   1.822 +typedef struct {
   1.823 +  enum XML_Parsing parsing;
   1.824 +  XML_Bool finalBuffer;
   1.825 +} XML_ParsingStatus;
   1.826 +
   1.827 +/* Returns status of parser with respect to being initialized, parsing,
   1.828 +   finished, or suspended and processing the final buffer.
   1.829 +   XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
   1.830 +   XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
   1.831 +*/
   1.832 +XMLPARSEAPI(void)
   1.833 +XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
   1.834 +
   1.835 +/* Creates an XML_Parser object that can parse an external general
   1.836 +   entity; context is a '\0'-terminated string specifying the parse
   1.837 +   context; encoding is a '\0'-terminated string giving the name of
   1.838 +   the externally specified encoding, or NULL if there is no
   1.839 +   externally specified encoding.  The context string consists of a
   1.840 +   sequence of tokens separated by formfeeds (\f); a token consisting
   1.841 +   of a name specifies that the general entity of the name is open; a
   1.842 +   token of the form prefix=uri specifies the namespace for a
   1.843 +   particular prefix; a token of the form =uri specifies the default
   1.844 +   namespace.  This can be called at any point after the first call to
   1.845 +   an ExternalEntityRefHandler so longer as the parser has not yet
   1.846 +   been freed.  The new parser is completely independent and may
   1.847 +   safely be used in a separate thread.  The handlers and userData are
   1.848 +   initialized from the parser argument.  Returns NULL if out of memory.
   1.849 +   Otherwise returns a new XML_Parser object.
   1.850 +*/
   1.851 +XMLPARSEAPI(XML_Parser)
   1.852 +XML_ExternalEntityParserCreate(XML_Parser parser,
   1.853 +                               const XML_Char *context,
   1.854 +                               const XML_Char *encoding);
   1.855 +
   1.856 +enum XML_ParamEntityParsing {
   1.857 +  XML_PARAM_ENTITY_PARSING_NEVER,
   1.858 +  XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
   1.859 +  XML_PARAM_ENTITY_PARSING_ALWAYS
   1.860 +};
   1.861 +
   1.862 +/* Controls parsing of parameter entities (including the external DTD
   1.863 +   subset). If parsing of parameter entities is enabled, then
   1.864 +   references to external parameter entities (including the external
   1.865 +   DTD subset) will be passed to the handler set with
   1.866 +   XML_SetExternalEntityRefHandler.  The context passed will be 0.
   1.867 +
   1.868 +   Unlike external general entities, external parameter entities can
   1.869 +   only be parsed synchronously.  If the external parameter entity is
   1.870 +   to be parsed, it must be parsed during the call to the external
   1.871 +   entity ref handler: the complete sequence of
   1.872 +   XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
   1.873 +   XML_ParserFree calls must be made during this call.  After
   1.874 +   XML_ExternalEntityParserCreate has been called to create the parser
   1.875 +   for the external parameter entity (context must be 0 for this
   1.876 +   call), it is illegal to make any calls on the old parser until
   1.877 +   XML_ParserFree has been called on the newly created parser.
   1.878 +   If the library has been compiled without support for parameter
   1.879 +   entity parsing (ie without XML_DTD being defined), then
   1.880 +   XML_SetParamEntityParsing will return 0 if parsing of parameter
   1.881 +   entities is requested; otherwise it will return non-zero.
   1.882 +   Note: If XML_SetParamEntityParsing is called after XML_Parse or
   1.883 +      XML_ParseBuffer, then it has no effect and will always return 0.
   1.884 +*/
   1.885 +XMLPARSEAPI(int)
   1.886 +XML_SetParamEntityParsing(XML_Parser parser,
   1.887 +                          enum XML_ParamEntityParsing parsing);
   1.888 +
   1.889 +/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
   1.890 +   XML_GetErrorCode returns information about the error.
   1.891 +*/
   1.892 +XMLPARSEAPI(enum XML_Error)
   1.893 +XML_GetErrorCode(XML_Parser parser);
   1.894 +
   1.895 +/* These functions return information about the current parse
   1.896 +   location.  They may be called from any callback called to report
   1.897 +   some parse event; in this case the location is the location of the
   1.898 +   first of the sequence of characters that generated the event.  When
   1.899 +   called from callbacks generated by declarations in the document
   1.900 +   prologue, the location identified isn't as neatly defined, but will
   1.901 +   be within the relevant markup.  When called outside of the callback
   1.902 +   functions, the position indicated will be just past the last parse
   1.903 +   event (regardless of whether there was an associated callback).
   1.904 +   
   1.905 +   They may also be called after returning from a call to XML_Parse
   1.906 +   or XML_ParseBuffer.  If the return value is XML_STATUS_ERROR then
   1.907 +   the location is the location of the character at which the error
   1.908 +   was detected; otherwise the location is the location of the last
   1.909 +   parse event, as described above.
   1.910 +*/
   1.911 +XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
   1.912 +XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
   1.913 +XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
   1.914 +
   1.915 +/* Return the number of bytes in the current event.
   1.916 +   Returns 0 if the event is in an internal entity.
   1.917 +*/
   1.918 +XMLPARSEAPI(int)
   1.919 +XML_GetCurrentByteCount(XML_Parser parser);
   1.920 +
   1.921 +/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
   1.922 +   the integer pointed to by offset to the offset within this buffer
   1.923 +   of the current parse position, and sets the integer pointed to by size
   1.924 +   to the size of this buffer (the number of input bytes). Otherwise
   1.925 +   returns a NULL pointer. Also returns a NULL pointer if a parse isn't
   1.926 +   active.
   1.927 +
   1.928 +   NOTE: The character pointer returned should not be used outside
   1.929 +   the handler that makes the call.
   1.930 +*/
   1.931 +XMLPARSEAPI(const char *)
   1.932 +XML_GetInputContext(XML_Parser parser,
   1.933 +                    int *offset,
   1.934 +                    int *size);
   1.935 +
   1.936 +/* For backwards compatibility with previous versions. */
   1.937 +#define XML_GetErrorLineNumber   XML_GetCurrentLineNumber
   1.938 +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
   1.939 +#define XML_GetErrorByteIndex    XML_GetCurrentByteIndex
   1.940 +
   1.941 +/* Frees the content model passed to the element declaration handler */
   1.942 +XMLPARSEAPI(void)
   1.943 +XML_FreeContentModel(XML_Parser parser, XML_Content *model);
   1.944 +
   1.945 +/* Exposing the memory handling functions used in Expat */
   1.946 +XMLPARSEAPI(void *)
   1.947 +XML_MemMalloc(XML_Parser parser, size_t size);
   1.948 +
   1.949 +XMLPARSEAPI(void *)
   1.950 +XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
   1.951 +
   1.952 +XMLPARSEAPI(void)
   1.953 +XML_MemFree(XML_Parser parser, void *ptr);
   1.954 +
   1.955 +/* Frees memory used by the parser. */
   1.956 +XMLPARSEAPI(void)
   1.957 +XML_ParserFree(XML_Parser parser);
   1.958 +
   1.959 +/* Returns a string describing the error. */
   1.960 +XMLPARSEAPI(const XML_LChar *)
   1.961 +XML_ErrorString(enum XML_Error code);
   1.962 +
   1.963 +/* Return a string containing the version number of this expat */
   1.964 +XMLPARSEAPI(const XML_LChar *)
   1.965 +XML_ExpatVersion(void);
   1.966 +
   1.967 +typedef struct {
   1.968 +  int major;
   1.969 +  int minor;
   1.970 +  int micro;
   1.971 +} XML_Expat_Version;
   1.972 +
   1.973 +/* Return an XML_Expat_Version structure containing numeric version
   1.974 +   number information for this version of expat.
   1.975 +*/
   1.976 +XMLPARSEAPI(XML_Expat_Version)
   1.977 +XML_ExpatVersionInfo(void);
   1.978 +
   1.979 +/* Added in Expat 1.95.5. */
   1.980 +enum XML_FeatureEnum {
   1.981 +  XML_FEATURE_END = 0,
   1.982 +  XML_FEATURE_UNICODE,
   1.983 +  XML_FEATURE_UNICODE_WCHAR_T,
   1.984 +  XML_FEATURE_DTD,
   1.985 +  XML_FEATURE_CONTEXT_BYTES,
   1.986 +  XML_FEATURE_MIN_SIZE,
   1.987 +  XML_FEATURE_SIZEOF_XML_CHAR,
   1.988 +  XML_FEATURE_SIZEOF_XML_LCHAR,
   1.989 +  XML_FEATURE_NS
   1.990 +  /* Additional features must be added to the end of this enum. */
   1.991 +};
   1.992 +
   1.993 +typedef struct {
   1.994 +  enum XML_FeatureEnum  feature;
   1.995 +  const XML_LChar       *name;
   1.996 +  long int              value;
   1.997 +} XML_Feature;
   1.998 +
   1.999 +XMLPARSEAPI(const XML_Feature *)
  1.1000 +XML_GetFeatureList(void);
  1.1001 +
  1.1002 +
  1.1003 +/* Expat follows the GNU/Linux convention of odd number minor version for
  1.1004 +   beta/development releases and even number minor version for stable
  1.1005 +   releases. Micro is bumped with each release, and set to 0 with each
  1.1006 +   change to major or minor version.
  1.1007 +*/
  1.1008 +#define XML_MAJOR_VERSION 2
  1.1009 +#define XML_MINOR_VERSION 0
  1.1010 +#define XML_MICRO_VERSION 0
  1.1011 +
  1.1012 +/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
  1.1013 +XMLPARSEAPI(const XML_Char*)
  1.1014 +MOZ_XML_GetMismatchedTag(XML_Parser parser);
  1.1015 +/* END MOZILLA CHANGE */
  1.1016 +
  1.1017 +#ifdef __cplusplus
  1.1018 +}
  1.1019 +#endif
  1.1020 +
  1.1021 +#endif /* not Expat_INCLUDED */

mercurial