Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:21

0001 /*
0002                             __  __            _
0003                          ___\ \/ /_ __   __ _| |_
0004                         / _ \\  /| '_ \ / _` | __|
0005                        |  __//  \| |_) | (_| | |_
0006                         \___/_/\_\ .__/ \__,_|\__|
0007                                  |_| XML parser
0008 
0009    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
0010    Copyright (c) 2000      Clark Cooper <coopercc@users.sourceforge.net>
0011    Copyright (c) 2000-2005 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
0012    Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
0013    Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
0014    Copyright (c) 2016-2024 Sebastian Pipping <sebastian@pipping.org>
0015    Copyright (c) 2016      Cristian Rodríguez <crrodriguez@opensuse.org>
0016    Copyright (c) 2016      Thomas Beutlich <tc@tbeu.de>
0017    Copyright (c) 2017      Rhodri James <rhodri@wildebeest.org.uk>
0018    Copyright (c) 2022      Thijs Schreijer <thijs@thijsschreijer.nl>
0019    Copyright (c) 2023      Hanno Böck <hanno@gentoo.org>
0020    Copyright (c) 2023      Sony Corporation / Snild Dolkow <snild@sony.com>
0021    Copyright (c) 2024      Taichi Haradaguchi <20001722@ymail.ne.jp>
0022    Licensed under the MIT license:
0023 
0024    Permission is  hereby granted,  free of charge,  to any  person obtaining
0025    a  copy  of  this  software   and  associated  documentation  files  (the
0026    "Software"),  to  deal in  the  Software  without restriction,  including
0027    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
0028    distribute, sublicense, and/or sell copies of the Software, and to permit
0029    persons  to whom  the Software  is  furnished to  do so,  subject to  the
0030    following conditions:
0031 
0032    The above copyright  notice and this permission notice  shall be included
0033    in all copies or substantial portions of the Software.
0034 
0035    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
0036    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
0037    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
0038    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
0039    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
0040    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
0041    USE OR OTHER DEALINGS IN THE SOFTWARE.
0042 */
0043 
0044 #ifndef Expat_INCLUDED
0045 #define Expat_INCLUDED 1
0046 
0047 #include <stdlib.h>
0048 #include "expat_external.h"
0049 
0050 #ifdef __cplusplus
0051 extern "C" {
0052 #endif
0053 
0054 struct XML_ParserStruct;
0055 typedef struct XML_ParserStruct *XML_Parser;
0056 
0057 typedef unsigned char XML_Bool;
0058 #define XML_TRUE ((XML_Bool)1)
0059 #define XML_FALSE ((XML_Bool)0)
0060 
0061 /* The XML_Status enum gives the possible return values for several
0062    API functions.  The preprocessor #defines are included so this
0063    stanza can be added to code that still needs to support older
0064    versions of Expat 1.95.x:
0065 
0066    #ifndef XML_STATUS_OK
0067    #define XML_STATUS_OK    1
0068    #define XML_STATUS_ERROR 0
0069    #endif
0070 
0071    Otherwise, the #define hackery is quite ugly and would have been
0072    dropped.
0073 */
0074 enum XML_Status {
0075   XML_STATUS_ERROR = 0,
0076 #define XML_STATUS_ERROR XML_STATUS_ERROR
0077   XML_STATUS_OK = 1,
0078 #define XML_STATUS_OK XML_STATUS_OK
0079   XML_STATUS_SUSPENDED = 2
0080 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
0081 };
0082 
0083 enum XML_Error {
0084   XML_ERROR_NONE,
0085   XML_ERROR_NO_MEMORY,
0086   XML_ERROR_SYNTAX,
0087   XML_ERROR_NO_ELEMENTS,
0088   XML_ERROR_INVALID_TOKEN,
0089   XML_ERROR_UNCLOSED_TOKEN,
0090   XML_ERROR_PARTIAL_CHAR,
0091   XML_ERROR_TAG_MISMATCH,
0092   XML_ERROR_DUPLICATE_ATTRIBUTE,
0093   XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
0094   XML_ERROR_PARAM_ENTITY_REF,
0095   XML_ERROR_UNDEFINED_ENTITY,
0096   XML_ERROR_RECURSIVE_ENTITY_REF,
0097   XML_ERROR_ASYNC_ENTITY,
0098   XML_ERROR_BAD_CHAR_REF,
0099   XML_ERROR_BINARY_ENTITY_REF,
0100   XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
0101   XML_ERROR_MISPLACED_XML_PI,
0102   XML_ERROR_UNKNOWN_ENCODING,
0103   XML_ERROR_INCORRECT_ENCODING,
0104   XML_ERROR_UNCLOSED_CDATA_SECTION,
0105   XML_ERROR_EXTERNAL_ENTITY_HANDLING,
0106   XML_ERROR_NOT_STANDALONE,
0107   XML_ERROR_UNEXPECTED_STATE,
0108   XML_ERROR_ENTITY_DECLARED_IN_PE,
0109   XML_ERROR_FEATURE_REQUIRES_XML_DTD,
0110   XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,
0111   /* Added in 1.95.7. */
0112   XML_ERROR_UNBOUND_PREFIX,
0113   /* Added in 1.95.8. */
0114   XML_ERROR_UNDECLARING_PREFIX,
0115   XML_ERROR_INCOMPLETE_PE,
0116   XML_ERROR_XML_DECL,
0117   XML_ERROR_TEXT_DECL,
0118   XML_ERROR_PUBLICID,
0119   XML_ERROR_SUSPENDED,
0120   XML_ERROR_NOT_SUSPENDED,
0121   XML_ERROR_ABORTED,
0122   XML_ERROR_FINISHED,
0123   XML_ERROR_SUSPEND_PE,
0124   /* Added in 2.0. */
0125   XML_ERROR_RESERVED_PREFIX_XML,
0126   XML_ERROR_RESERVED_PREFIX_XMLNS,
0127   XML_ERROR_RESERVED_NAMESPACE_URI,
0128   /* Added in 2.2.1. */
0129   XML_ERROR_INVALID_ARGUMENT,
0130   /* Added in 2.3.0. */
0131   XML_ERROR_NO_BUFFER,
0132   /* Added in 2.4.0. */
0133   XML_ERROR_AMPLIFICATION_LIMIT_BREACH,
0134   /* Added in 2.6.4. */
0135   XML_ERROR_NOT_STARTED,
0136 };
0137 
0138 enum XML_Content_Type {
0139   XML_CTYPE_EMPTY = 1,
0140   XML_CTYPE_ANY,
0141   XML_CTYPE_MIXED,
0142   XML_CTYPE_NAME,
0143   XML_CTYPE_CHOICE,
0144   XML_CTYPE_SEQ
0145 };
0146 
0147 enum XML_Content_Quant {
0148   XML_CQUANT_NONE,
0149   XML_CQUANT_OPT,
0150   XML_CQUANT_REP,
0151   XML_CQUANT_PLUS
0152 };
0153 
0154 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
0155    XML_CQUANT_NONE, and the other fields will be zero or NULL.
0156    If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
0157    numchildren will contain number of elements that may be mixed in
0158    and children point to an array of XML_Content cells that will be
0159    all of XML_CTYPE_NAME type with no quantification.
0160 
0161    If type == XML_CTYPE_NAME, then the name points to the name, and
0162    the numchildren field will be zero and children will be NULL. The
0163    quant fields indicates any quantifiers placed on the name.
0164 
0165    CHOICE and SEQ will have name NULL, the number of children in
0166    numchildren and children will point, recursively, to an array
0167    of XML_Content cells.
0168 
0169    The EMPTY, ANY, and MIXED types will only occur at top level.
0170 */
0171 
0172 typedef struct XML_cp XML_Content;
0173 
0174 struct XML_cp {
0175   enum XML_Content_Type type;
0176   enum XML_Content_Quant quant;
0177   XML_Char *name;
0178   unsigned int numchildren;
0179   XML_Content *children;
0180 };
0181 
0182 /* This is called for an element declaration. See above for
0183    description of the model argument. It's the user code's responsibility
0184    to free model when finished with it. See XML_FreeContentModel.
0185    There is no need to free the model from the handler, it can be kept
0186    around and freed at a later stage.
0187 */
0188 typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
0189                                               const XML_Char *name,
0190                                               XML_Content *model);
0191 
0192 XMLPARSEAPI(void)
0193 XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
0194 
0195 /* The Attlist declaration handler is called for *each* attribute. So
0196    a single Attlist declaration with multiple attributes declared will
0197    generate multiple calls to this handler. The "default" parameter
0198    may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
0199    keyword. The "isrequired" parameter will be true and the default
0200    value will be NULL in the case of "#REQUIRED". If "isrequired" is
0201    true and default is non-NULL, then this is a "#FIXED" default.
0202 */
0203 typedef void(XMLCALL *XML_AttlistDeclHandler)(
0204     void *userData, const XML_Char *elname, const XML_Char *attname,
0205     const XML_Char *att_type, const XML_Char *dflt, int isrequired);
0206 
0207 XMLPARSEAPI(void)
0208 XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
0209 
0210 /* The XML declaration handler is called for *both* XML declarations
0211    and text declarations. The way to distinguish is that the version
0212    parameter will be NULL for text declarations. The encoding
0213    parameter may be NULL for XML declarations. The standalone
0214    parameter will be -1, 0, or 1 indicating respectively that there
0215    was no standalone parameter in the declaration, that it was given
0216    as no, or that it was given as yes.
0217 */
0218 typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,
0219                                           const XML_Char *version,
0220                                           const XML_Char *encoding,
0221                                           int standalone);
0222 
0223 XMLPARSEAPI(void)
0224 XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
0225 
0226 typedef struct {
0227   void *(*malloc_fcn)(size_t size);
0228   void *(*realloc_fcn)(void *ptr, size_t size);
0229   void (*free_fcn)(void *ptr);
0230 } XML_Memory_Handling_Suite;
0231 
0232 /* Constructs a new parser; encoding is the encoding specified by the
0233    external protocol or NULL if there is none specified.
0234 */
0235 XMLPARSEAPI(XML_Parser)
0236 XML_ParserCreate(const XML_Char *encoding);
0237 
0238 /* Constructs a new parser and namespace processor.  Element type
0239    names and attribute names that belong to a namespace will be
0240    expanded; unprefixed attribute names are never expanded; unprefixed
0241    element type names are expanded only if there is a default
0242    namespace. The expanded name is the concatenation of the namespace
0243    URI, the namespace separator character, and the local part of the
0244    name.  If the namespace separator is '\0' then the namespace URI
0245    and the local part will be concatenated without any separator.
0246    It is a programming error to use the separator '\0' with namespace
0247    triplets (see XML_SetReturnNSTriplet).
0248    If a namespace separator is chosen that can be part of a URI or
0249    part of an XML name, splitting an expanded name back into its
0250    1, 2 or 3 original parts on application level in the element handler
0251    may end up vulnerable, so these are advised against;  sane choices for
0252    a namespace separator are e.g. '\n' (line feed) and '|' (pipe).
0253 
0254    Note that Expat does not validate namespace URIs (beyond encoding)
0255    against RFC 3986 today (and is not required to do so with regard to
0256    the XML 1.0 namespaces specification) but it may start doing that
0257    in future releases.  Before that, an application using Expat must
0258    be ready to receive namespace URIs containing non-URI characters.
0259 */
0260 XMLPARSEAPI(XML_Parser)
0261 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
0262 
0263 /* Constructs a new parser using the memory management suite referred to
0264    by memsuite. If memsuite is NULL, then use the standard library memory
0265    suite. If namespaceSeparator is non-NULL it creates a parser with
0266    namespace processing as described above. The character pointed at
0267    will serve as the namespace separator.
0268 
0269    All further memory operations used for the created parser will come from
0270    the given suite.
0271 */
0272 XMLPARSEAPI(XML_Parser)
0273 XML_ParserCreate_MM(const XML_Char *encoding,
0274                     const XML_Memory_Handling_Suite *memsuite,
0275                     const XML_Char *namespaceSeparator);
0276 
0277 /* Prepare a parser object to be reused.  This is particularly
0278    valuable when memory allocation overhead is disproportionately high,
0279    such as when a large number of small documnents need to be parsed.
0280    All handlers are cleared from the parser, except for the
0281    unknownEncodingHandler. The parser's external state is re-initialized
0282    except for the values of ns and ns_triplets.
0283 
0284    Added in Expat 1.95.3.
0285 */
0286 XMLPARSEAPI(XML_Bool)
0287 XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
0288 
0289 /* atts is array of name/value pairs, terminated by 0;
0290    names and values are 0 terminated.
0291 */
0292 typedef void(XMLCALL *XML_StartElementHandler)(void *userData,
0293                                                const XML_Char *name,
0294                                                const XML_Char **atts);
0295 
0296 typedef void(XMLCALL *XML_EndElementHandler)(void *userData,
0297                                              const XML_Char *name);
0298 
0299 /* s is not 0 terminated. */
0300 typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,
0301                                                 const XML_Char *s, int len);
0302 
0303 /* target and data are 0 terminated */
0304 typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
0305                                                         const XML_Char *target,
0306                                                         const XML_Char *data);
0307 
0308 /* data is 0 terminated */
0309 typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);
0310 
0311 typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
0312 typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
0313 
0314 /* This is called for any characters in the XML document for which
0315    there is no applicable handler.  This includes both characters that
0316    are part of markup which is of a kind that is not reported
0317    (comments, markup declarations), or characters that are part of a
0318    construct which could be reported but for which no handler has been
0319    supplied. The characters are passed exactly as they were in the XML
0320    document except that they will be encoded in UTF-8 or UTF-16.
0321    Line boundaries are not normalized. Note that a byte order mark
0322    character is not passed to the default handler. There are no
0323    guarantees about how characters are divided between calls to the
0324    default handler: for example, a comment might be split between
0325    multiple calls.
0326 */
0327 typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,
0328                                           int len);
0329 
0330 /* This is called for the start of the DOCTYPE declaration, before
0331    any DTD or internal subset is parsed.
0332 */
0333 typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
0334                                                    const XML_Char *doctypeName,
0335                                                    const XML_Char *sysid,
0336                                                    const XML_Char *pubid,
0337                                                    int has_internal_subset);
0338 
0339 /* This is called for the end of the DOCTYPE declaration when the
0340    closing > is encountered, but after processing any external
0341    subset.
0342 */
0343 typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
0344 
0345 /* This is called for entity declarations. The is_parameter_entity
0346    argument will be non-zero if the entity is a parameter entity, zero
0347    otherwise.
0348 
0349    For internal entities (<!ENTITY foo "bar">), value will
0350    be non-NULL and systemId, publicID, and notationName will be NULL.
0351    The value string is NOT null-terminated; the length is provided in
0352    the value_length argument. Since it is legal to have zero-length
0353    values, do not use this argument to test for internal entities.
0354 
0355    For external entities, value will be NULL and systemId will be
0356    non-NULL. The publicId argument will be NULL unless a public
0357    identifier was provided. The notationName argument will have a
0358    non-NULL value only for unparsed entity declarations.
0359 
0360    Note that is_parameter_entity can't be changed to XML_Bool, since
0361    that would break binary compatibility.
0362 */
0363 typedef void(XMLCALL *XML_EntityDeclHandler)(
0364     void *userData, const XML_Char *entityName, int is_parameter_entity,
0365     const XML_Char *value, int value_length, const XML_Char *base,
0366     const XML_Char *systemId, const XML_Char *publicId,
0367     const XML_Char *notationName);
0368 
0369 XMLPARSEAPI(void)
0370 XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
0371 
0372 /* OBSOLETE -- OBSOLETE -- OBSOLETE
0373    This handler has been superseded by the EntityDeclHandler above.
0374    It is provided here for backward compatibility.
0375 
0376    This is called for a declaration of an unparsed (NDATA) entity.
0377    The base argument is whatever was set by XML_SetBase. The
0378    entityName, systemId and notationName arguments will never be
0379    NULL. The other arguments may be.
0380 */
0381 typedef void(XMLCALL *XML_UnparsedEntityDeclHandler)(
0382     void *userData, const XML_Char *entityName, const XML_Char *base,
0383     const XML_Char *systemId, const XML_Char *publicId,
0384     const XML_Char *notationName);
0385 
0386 /* This is called for a declaration of notation.  The base argument is
0387    whatever was set by XML_SetBase. The notationName will never be
0388    NULL.  The other arguments can be.
0389 */
0390 typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,
0391                                                const XML_Char *notationName,
0392                                                const XML_Char *base,
0393                                                const XML_Char *systemId,
0394                                                const XML_Char *publicId);
0395 
0396 /* When namespace processing is enabled, these are called once for
0397    each namespace declaration. The call to the start and end element
0398    handlers occur between the calls to the start and end namespace
0399    declaration handlers. For an xmlns attribute, prefix will be
0400    NULL.  For an xmlns="" attribute, uri will be NULL.
0401 */
0402 typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
0403                                                      const XML_Char *prefix,
0404                                                      const XML_Char *uri);
0405 
0406 typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
0407                                                    const XML_Char *prefix);
0408 
0409 /* This is called if the document is not standalone, that is, it has an
0410    external subset or a reference to a parameter entity, but does not
0411    have standalone="yes". If this handler returns XML_STATUS_ERROR,
0412    then processing will not continue, and the parser will return a
0413    XML_ERROR_NOT_STANDALONE error.
0414    If parameter entity parsing is enabled, then in addition to the
0415    conditions above this handler will only be called if the referenced
0416    entity was actually read.
0417 */
0418 typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
0419 
0420 /* This is called for a reference to an external parsed general
0421    entity.  The referenced entity is not automatically parsed.  The
0422    application can parse it immediately or later using
0423    XML_ExternalEntityParserCreate.
0424 
0425    The parser argument is the parser parsing the entity containing the
0426    reference; it can be passed as the parser argument to
0427    XML_ExternalEntityParserCreate.  The systemId argument is the
0428    system identifier as specified in the entity declaration; it will
0429    not be NULL.
0430 
0431    The base argument is the system identifier that should be used as
0432    the base for resolving systemId if systemId was relative; this is
0433    set by XML_SetBase; it may be NULL.
0434 
0435    The publicId argument is the public identifier as specified in the
0436    entity declaration, or NULL if none was specified; the whitespace
0437    in the public identifier will have been normalized as required by
0438    the XML spec.
0439 
0440    The context argument specifies the parsing context in the format
0441    expected by the context argument to XML_ExternalEntityParserCreate;
0442    context is valid only until the handler returns, so if the
0443    referenced entity is to be parsed later, it must be copied.
0444    context is NULL only when the entity is a parameter entity.
0445 
0446    The handler should return XML_STATUS_ERROR if processing should not
0447    continue because of a fatal error in the handling of the external
0448    entity.  In this case the calling parser will return an
0449    XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
0450 
0451    Note that unlike other handlers the first argument is the parser,
0452    not userData.
0453 */
0454 typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,
0455                                                    const XML_Char *context,
0456                                                    const XML_Char *base,
0457                                                    const XML_Char *systemId,
0458                                                    const XML_Char *publicId);
0459 
0460 /* This is called in two situations:
0461    1) An entity reference is encountered for which no declaration
0462       has been read *and* this is not an error.
0463    2) An internal entity reference is read, but not expanded, because
0464       XML_SetDefaultHandler has been called.
0465    Note: skipped parameter entities in declarations and skipped general
0466          entities in attribute values cannot be reported, because
0467          the event would be out of sync with the reporting of the
0468          declarations or attribute values
0469 */
0470 typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
0471                                                 const XML_Char *entityName,
0472                                                 int is_parameter_entity);
0473 
0474 /* This structure is filled in by the XML_UnknownEncodingHandler to
0475    provide information to the parser about encodings that are unknown
0476    to the parser.
0477 
0478    The map[b] member gives information about byte sequences whose
0479    first byte is b.
0480 
0481    If map[b] is c where c is >= 0, then b by itself encodes the
0482    Unicode scalar value c.
0483 
0484    If map[b] is -1, then the byte sequence is malformed.
0485 
0486    If map[b] is -n, where n >= 2, then b is the first byte of an
0487    n-byte sequence that encodes a single Unicode scalar value.
0488 
0489    The data member will be passed as the first argument to the convert
0490    function.
0491 
0492    The convert function is used to convert multibyte sequences; s will
0493    point to a n-byte sequence where map[(unsigned char)*s] == -n.  The
0494    convert function must return the Unicode scalar value represented
0495    by this byte sequence or -1 if the byte sequence is malformed.
0496 
0497    The convert function may be NULL if the encoding is a single-byte
0498    encoding, that is if map[b] >= -1 for all bytes b.
0499 
0500    When the parser is finished with the encoding, then if release is
0501    not NULL, it will call release passing it the data member; once
0502    release has been called, the convert function will not be called
0503    again.
0504 
0505    Expat places certain restrictions on the encodings that are supported
0506    using this mechanism.
0507 
0508    1. Every ASCII character that can appear in a well-formed XML document,
0509       other than the characters
0510 
0511       $@\^`{}~
0512 
0513       must be represented by a single byte, and that byte must be the
0514       same byte that represents that character in ASCII.
0515 
0516    2. No character may require more than 4 bytes to encode.
0517 
0518    3. All characters encoded must have Unicode scalar values <=
0519       0xFFFF, (i.e., characters that would be encoded by surrogates in
0520       UTF-16 are  not allowed).  Note that this restriction doesn't
0521       apply to the built-in support for UTF-8 and UTF-16.
0522 
0523    4. No Unicode character may be encoded by more than one distinct
0524       sequence of bytes.
0525 */
0526 typedef struct {
0527   int map[256];
0528   void *data;
0529   int(XMLCALL *convert)(void *data, const char *s);
0530   void(XMLCALL *release)(void *data);
0531 } XML_Encoding;
0532 
0533 /* This is called for an encoding that is unknown to the parser.
0534 
0535    The encodingHandlerData argument is that which was passed as the
0536    second argument to XML_SetUnknownEncodingHandler.
0537 
0538    The name argument gives the name of the encoding as specified in
0539    the encoding declaration.
0540 
0541    If the callback can provide information about the encoding, it must
0542    fill in the XML_Encoding structure, and return XML_STATUS_OK.
0543    Otherwise it must return XML_STATUS_ERROR.
0544 
0545    If info does not describe a suitable encoding, then the parser will
0546    return an XML_ERROR_UNKNOWN_ENCODING error.
0547 */
0548 typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
0549                                                  const XML_Char *name,
0550                                                  XML_Encoding *info);
0551 
0552 XMLPARSEAPI(void)
0553 XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
0554                       XML_EndElementHandler end);
0555 
0556 XMLPARSEAPI(void)
0557 XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);
0558 
0559 XMLPARSEAPI(void)
0560 XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
0561 
0562 XMLPARSEAPI(void)
0563 XML_SetCharacterDataHandler(XML_Parser parser,
0564                             XML_CharacterDataHandler handler);
0565 
0566 XMLPARSEAPI(void)
0567 XML_SetProcessingInstructionHandler(XML_Parser parser,
0568                                     XML_ProcessingInstructionHandler handler);
0569 XMLPARSEAPI(void)
0570 XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
0571 
0572 XMLPARSEAPI(void)
0573 XML_SetCdataSectionHandler(XML_Parser parser,
0574                            XML_StartCdataSectionHandler start,
0575                            XML_EndCdataSectionHandler end);
0576 
0577 XMLPARSEAPI(void)
0578 XML_SetStartCdataSectionHandler(XML_Parser parser,
0579                                 XML_StartCdataSectionHandler start);
0580 
0581 XMLPARSEAPI(void)
0582 XML_SetEndCdataSectionHandler(XML_Parser parser,
0583                               XML_EndCdataSectionHandler end);
0584 
0585 /* This sets the default handler and also inhibits expansion of
0586    internal entities. These entity references will be passed to the
0587    default handler, or to the skipped entity handler, if one is set.
0588 */
0589 XMLPARSEAPI(void)
0590 XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
0591 
0592 /* This sets the default handler but does not inhibit expansion of
0593    internal entities.  The entity reference will not be passed to the
0594    default handler.
0595 */
0596 XMLPARSEAPI(void)
0597 XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
0598 
0599 XMLPARSEAPI(void)
0600 XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,
0601                           XML_EndDoctypeDeclHandler end);
0602 
0603 XMLPARSEAPI(void)
0604 XML_SetStartDoctypeDeclHandler(XML_Parser parser,
0605                                XML_StartDoctypeDeclHandler start);
0606 
0607 XMLPARSEAPI(void)
0608 XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);
0609 
0610 XMLPARSEAPI(void)
0611 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
0612                                  XML_UnparsedEntityDeclHandler handler);
0613 
0614 XMLPARSEAPI(void)
0615 XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);
0616 
0617 XMLPARSEAPI(void)
0618 XML_SetNamespaceDeclHandler(XML_Parser parser,
0619                             XML_StartNamespaceDeclHandler start,
0620                             XML_EndNamespaceDeclHandler end);
0621 
0622 XMLPARSEAPI(void)
0623 XML_SetStartNamespaceDeclHandler(XML_Parser parser,
0624                                  XML_StartNamespaceDeclHandler start);
0625 
0626 XMLPARSEAPI(void)
0627 XML_SetEndNamespaceDeclHandler(XML_Parser parser,
0628                                XML_EndNamespaceDeclHandler end);
0629 
0630 XMLPARSEAPI(void)
0631 XML_SetNotStandaloneHandler(XML_Parser parser,
0632                             XML_NotStandaloneHandler handler);
0633 
0634 XMLPARSEAPI(void)
0635 XML_SetExternalEntityRefHandler(XML_Parser parser,
0636                                 XML_ExternalEntityRefHandler handler);
0637 
0638 /* If a non-NULL value for arg is specified here, then it will be
0639    passed as the first argument to the external entity ref handler
0640    instead of the parser object.
0641 */
0642 XMLPARSEAPI(void)
0643 XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
0644 
0645 XMLPARSEAPI(void)
0646 XML_SetSkippedEntityHandler(XML_Parser parser,
0647                             XML_SkippedEntityHandler handler);
0648 
0649 XMLPARSEAPI(void)
0650 XML_SetUnknownEncodingHandler(XML_Parser parser,
0651                               XML_UnknownEncodingHandler handler,
0652                               void *encodingHandlerData);
0653 
0654 /* This can be called within a handler for a start element, end
0655    element, processing instruction or character data.  It causes the
0656    corresponding markup to be passed to the default handler.
0657 */
0658 XMLPARSEAPI(void)
0659 XML_DefaultCurrent(XML_Parser parser);
0660 
0661 /* If do_nst is non-zero, and namespace processing is in effect, and
0662    a name has a prefix (i.e. an explicit namespace qualifier) then
0663    that name is returned as a triplet in a single string separated by
0664    the separator character specified when the parser was created: URI
0665    + sep + local_name + sep + prefix.
0666 
0667    If do_nst is zero, then namespace information is returned in the
0668    default manner (URI + sep + local_name) whether or not the name
0669    has a prefix.
0670 
0671    Note: Calling XML_SetReturnNSTriplet after XML_Parse or
0672      XML_ParseBuffer has no effect.
0673 */
0674 
0675 XMLPARSEAPI(void)
0676 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
0677 
0678 /* This value is passed as the userData argument to callbacks. */
0679 XMLPARSEAPI(void)
0680 XML_SetUserData(XML_Parser parser, void *userData);
0681 
0682 /* Returns the last value set by XML_SetUserData or NULL. */
0683 #define XML_GetUserData(parser) (*(void **)(parser))
0684 
0685 /* This is equivalent to supplying an encoding argument to
0686    XML_ParserCreate. On success XML_SetEncoding returns non-zero,
0687    zero otherwise.
0688    Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
0689      has no effect and returns XML_STATUS_ERROR.
0690 */
0691 XMLPARSEAPI(enum XML_Status)
0692 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
0693 
0694 /* If this function is called, then the parser will be passed as the
0695    first argument to callbacks instead of userData.  The userData will
0696    still be accessible using XML_GetUserData.
0697 */
0698 XMLPARSEAPI(void)
0699 XML_UseParserAsHandlerArg(XML_Parser parser);
0700 
0701 /* If useDTD == XML_TRUE is passed to this function, then the parser
0702    will assume that there is an external subset, even if none is
0703    specified in the document. In such a case the parser will call the
0704    externalEntityRefHandler with a value of NULL for the systemId
0705    argument (the publicId and context arguments will be NULL as well).
0706    Note: For the purpose of checking WFC: Entity Declared, passing
0707      useDTD == XML_TRUE will make the parser behave as if the document
0708      had a DTD with an external subset.
0709    Note: If this function is called, then this must be done before
0710      the first call to XML_Parse or XML_ParseBuffer, since it will
0711      have no effect after that.  Returns
0712      XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
0713    Note: If the document does not have a DOCTYPE declaration at all,
0714      then startDoctypeDeclHandler and endDoctypeDeclHandler will not
0715      be called, despite an external subset being parsed.
0716    Note: If XML_DTD is not defined when Expat is compiled, returns
0717      XML_ERROR_FEATURE_REQUIRES_XML_DTD.
0718    Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT.
0719 */
0720 XMLPARSEAPI(enum XML_Error)
0721 XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
0722 
0723 /* Sets the base to be used for resolving relative URIs in system
0724    identifiers in declarations.  Resolving relative identifiers is
0725    left to the application: this value will be passed through as the
0726    base argument to the XML_ExternalEntityRefHandler,
0727    XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
0728    argument will be copied.  Returns XML_STATUS_ERROR if out of memory,
0729    XML_STATUS_OK otherwise.
0730 */
0731 XMLPARSEAPI(enum XML_Status)
0732 XML_SetBase(XML_Parser parser, const XML_Char *base);
0733 
0734 XMLPARSEAPI(const XML_Char *)
0735 XML_GetBase(XML_Parser parser);
0736 
0737 /* Returns the number of the attribute/value pairs passed in last call
0738    to the XML_StartElementHandler that were specified in the start-tag
0739    rather than defaulted. Each attribute/value pair counts as 2; thus
0740    this corresponds to an index into the atts array passed to the
0741    XML_StartElementHandler.  Returns -1 if parser == NULL.
0742 */
0743 XMLPARSEAPI(int)
0744 XML_GetSpecifiedAttributeCount(XML_Parser parser);
0745 
0746 /* Returns the index of the ID attribute passed in the last call to
0747    XML_StartElementHandler, or -1 if there is no ID attribute or
0748    parser == NULL.  Each attribute/value pair counts as 2; thus this
0749    corresponds to an index into the atts array passed to the
0750    XML_StartElementHandler.
0751 */
0752 XMLPARSEAPI(int)
0753 XML_GetIdAttributeIndex(XML_Parser parser);
0754 
0755 #ifdef XML_ATTR_INFO
0756 /* Source file byte offsets for the start and end of attribute names and values.
0757    The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
0758    file an attribute value of "blah" will yield:
0759    info->valueEnd - info->valueStart = 4 bytes.
0760 */
0761 typedef struct {
0762   XML_Index nameStart;  /* Offset to beginning of the attribute name. */
0763   XML_Index nameEnd;    /* Offset after the attribute name's last byte. */
0764   XML_Index valueStart; /* Offset to beginning of the attribute value. */
0765   XML_Index valueEnd;   /* Offset after the attribute value's last byte. */
0766 } XML_AttrInfo;
0767 
0768 /* Returns an array of XML_AttrInfo structures for the attribute/value pairs
0769    passed in last call to the XML_StartElementHandler that were specified
0770    in the start-tag rather than defaulted. Each attribute/value pair counts
0771    as 1; thus the number of entries in the array is
0772    XML_GetSpecifiedAttributeCount(parser) / 2.
0773 */
0774 XMLPARSEAPI(const XML_AttrInfo *)
0775 XML_GetAttributeInfo(XML_Parser parser);
0776 #endif
0777 
0778 /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
0779    detected.  The last call to XML_Parse must have isFinal true; len
0780    may be zero for this call (or any other).
0781 
0782    Though the return values for these functions has always been
0783    described as a Boolean value, the implementation, at least for the
0784    1.95.x series, has always returned exactly one of the XML_Status
0785    values.
0786 */
0787 XMLPARSEAPI(enum XML_Status)
0788 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
0789 
0790 XMLPARSEAPI(void *)
0791 XML_GetBuffer(XML_Parser parser, int len);
0792 
0793 XMLPARSEAPI(enum XML_Status)
0794 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
0795 
0796 /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
0797    Must be called from within a call-back handler, except when aborting
0798    (resumable = 0) an already suspended parser. Some call-backs may
0799    still follow because they would otherwise get lost. Examples:
0800    - endElementHandler() for empty elements when stopped in
0801      startElementHandler(),
0802    - endNameSpaceDeclHandler() when stopped in endElementHandler(),
0803    and possibly others.
0804 
0805    Can be called from most handlers, including DTD related call-backs,
0806    except when parsing an external parameter entity and resumable != 0.
0807    Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
0808    Possible error codes:
0809    - XML_ERROR_SUSPENDED: when suspending an already suspended parser.
0810    - XML_ERROR_FINISHED: when the parser has already finished.
0811    - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
0812 
0813    When resumable != 0 (true) then parsing is suspended, that is,
0814    XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED.
0815    Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()
0816    return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
0817 
0818    *Note*:
0819    This will be applied to the current parser instance only, that is, if
0820    there is a parent parser then it will continue parsing when the
0821    externalEntityRefHandler() returns. It is up to the implementation of
0822    the externalEntityRefHandler() to call XML_StopParser() on the parent
0823    parser (recursively), if one wants to stop parsing altogether.
0824 
0825    When suspended, parsing can be resumed by calling XML_ResumeParser().
0826 */
0827 XMLPARSEAPI(enum XML_Status)
0828 XML_StopParser(XML_Parser parser, XML_Bool resumable);
0829 
0830 /* Resumes parsing after it has been suspended with XML_StopParser().
0831    Must not be called from within a handler call-back. Returns same
0832    status codes as XML_Parse() or XML_ParseBuffer().
0833    Additional error code XML_ERROR_NOT_SUSPENDED possible.
0834 
0835    *Note*:
0836    This must be called on the most deeply nested child parser instance
0837    first, and on its parent parser only after the child parser has finished,
0838    to be applied recursively until the document entity's parser is restarted.
0839    That is, the parent parser will not resume by itself and it is up to the
0840    application to call XML_ResumeParser() on it at the appropriate moment.
0841 */
0842 XMLPARSEAPI(enum XML_Status)
0843 XML_ResumeParser(XML_Parser parser);
0844 
0845 enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };
0846 
0847 typedef struct {
0848   enum XML_Parsing parsing;
0849   XML_Bool finalBuffer;
0850 } XML_ParsingStatus;
0851 
0852 /* Returns status of parser with respect to being initialized, parsing,
0853    finished, or suspended and processing the final buffer.
0854    XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,
0855    XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED
0856 */
0857 XMLPARSEAPI(void)
0858 XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
0859 
0860 /* Creates an XML_Parser object that can parse an external general
0861    entity; context is a '\0'-terminated string specifying the parse
0862    context; encoding is a '\0'-terminated string giving the name of
0863    the externally specified encoding, or NULL if there is no
0864    externally specified encoding.  The context string consists of a
0865    sequence of tokens separated by formfeeds (\f); a token consisting
0866    of a name specifies that the general entity of the name is open; a
0867    token of the form prefix=uri specifies the namespace for a
0868    particular prefix; a token of the form =uri specifies the default
0869    namespace.  This can be called at any point after the first call to
0870    an ExternalEntityRefHandler so longer as the parser has not yet
0871    been freed.  The new parser is completely independent and may
0872    safely be used in a separate thread.  The handlers and userData are
0873    initialized from the parser argument.  Returns NULL if out of memory.
0874    Otherwise returns a new XML_Parser object.
0875 */
0876 XMLPARSEAPI(XML_Parser)
0877 XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,
0878                                const XML_Char *encoding);
0879 
0880 enum XML_ParamEntityParsing {
0881   XML_PARAM_ENTITY_PARSING_NEVER,
0882   XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
0883   XML_PARAM_ENTITY_PARSING_ALWAYS
0884 };
0885 
0886 /* Controls parsing of parameter entities (including the external DTD
0887    subset). If parsing of parameter entities is enabled, then
0888    references to external parameter entities (including the external
0889    DTD subset) will be passed to the handler set with
0890    XML_SetExternalEntityRefHandler.  The context passed will be 0.
0891 
0892    Unlike external general entities, external parameter entities can
0893    only be parsed synchronously.  If the external parameter entity is
0894    to be parsed, it must be parsed during the call to the external
0895    entity ref handler: the complete sequence of
0896    XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
0897    XML_ParserFree calls must be made during this call.  After
0898    XML_ExternalEntityParserCreate has been called to create the parser
0899    for the external parameter entity (context must be 0 for this
0900    call), it is illegal to make any calls on the old parser until
0901    XML_ParserFree has been called on the newly created parser.
0902    If the library has been compiled without support for parameter
0903    entity parsing (ie without XML_DTD being defined), then
0904    XML_SetParamEntityParsing will return 0 if parsing of parameter
0905    entities is requested; otherwise it will return non-zero.
0906    Note: If XML_SetParamEntityParsing is called after XML_Parse or
0907       XML_ParseBuffer, then it has no effect and will always return 0.
0908    Note: If parser == NULL, the function will do nothing and return 0.
0909 */
0910 XMLPARSEAPI(int)
0911 XML_SetParamEntityParsing(XML_Parser parser,
0912                           enum XML_ParamEntityParsing parsing);
0913 
0914 /* Sets the hash salt to use for internal hash calculations.
0915    Helps in preventing DoS attacks based on predicting hash
0916    function behavior. This must be called before parsing is started.
0917    Returns 1 if successful, 0 when called after parsing has started.
0918    Note: If parser == NULL, the function will do nothing and return 0.
0919 */
0920 XMLPARSEAPI(int)
0921 XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
0922 
0923 /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
0924    XML_GetErrorCode returns information about the error.
0925 */
0926 XMLPARSEAPI(enum XML_Error)
0927 XML_GetErrorCode(XML_Parser parser);
0928 
0929 /* These functions return information about the current parse
0930    location.  They may be called from any callback called to report
0931    some parse event; in this case the location is the location of the
0932    first of the sequence of characters that generated the event.  When
0933    called from callbacks generated by declarations in the document
0934    prologue, the location identified isn't as neatly defined, but will
0935    be within the relevant markup.  When called outside of the callback
0936    functions, the position indicated will be just past the last parse
0937    event (regardless of whether there was an associated callback).
0938 
0939    They may also be called after returning from a call to XML_Parse
0940    or XML_ParseBuffer.  If the return value is XML_STATUS_ERROR then
0941    the location is the location of the character at which the error
0942    was detected; otherwise the location is the location of the last
0943    parse event, as described above.
0944 
0945    Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber
0946    return 0 to indicate an error.
0947    Note: XML_GetCurrentByteIndex returns -1 to indicate an error.
0948 */
0949 XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
0950 XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
0951 XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
0952 
0953 /* Return the number of bytes in the current event.
0954    Returns 0 if the event is in an internal entity.
0955 */
0956 XMLPARSEAPI(int)
0957 XML_GetCurrentByteCount(XML_Parser parser);
0958 
0959 /* If XML_CONTEXT_BYTES is >=1, returns the input buffer, sets
0960    the integer pointed to by offset to the offset within this buffer
0961    of the current parse position, and sets the integer pointed to by size
0962    to the size of this buffer (the number of input bytes). Otherwise
0963    returns a NULL pointer. Also returns a NULL pointer if a parse isn't
0964    active.
0965 
0966    NOTE: The character pointer returned should not be used outside
0967    the handler that makes the call.
0968 */
0969 XMLPARSEAPI(const char *)
0970 XML_GetInputContext(XML_Parser parser, int *offset, int *size);
0971 
0972 /* For backwards compatibility with previous versions. */
0973 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
0974 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
0975 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
0976 
0977 /* Frees the content model passed to the element declaration handler */
0978 XMLPARSEAPI(void)
0979 XML_FreeContentModel(XML_Parser parser, XML_Content *model);
0980 
0981 /* Exposing the memory handling functions used in Expat */
0982 XMLPARSEAPI(void *)
0983 XML_ATTR_MALLOC
0984 XML_ATTR_ALLOC_SIZE(2)
0985 XML_MemMalloc(XML_Parser parser, size_t size);
0986 
0987 XMLPARSEAPI(void *)
0988 XML_ATTR_ALLOC_SIZE(3)
0989 XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
0990 
0991 XMLPARSEAPI(void)
0992 XML_MemFree(XML_Parser parser, void *ptr);
0993 
0994 /* Frees memory used by the parser. */
0995 XMLPARSEAPI(void)
0996 XML_ParserFree(XML_Parser parser);
0997 
0998 /* Returns a string describing the error. */
0999 XMLPARSEAPI(const XML_LChar *)
1000 XML_ErrorString(enum XML_Error code);
1001 
1002 /* Return a string containing the version number of this expat */
1003 XMLPARSEAPI(const XML_LChar *)
1004 XML_ExpatVersion(void);
1005 
1006 typedef struct {
1007   int major;
1008   int minor;
1009   int micro;
1010 } XML_Expat_Version;
1011 
1012 /* Return an XML_Expat_Version structure containing numeric version
1013    number information for this version of expat.
1014 */
1015 XMLPARSEAPI(XML_Expat_Version)
1016 XML_ExpatVersionInfo(void);
1017 
1018 /* Added in Expat 1.95.5. */
1019 enum XML_FeatureEnum {
1020   XML_FEATURE_END = 0,
1021   XML_FEATURE_UNICODE,
1022   XML_FEATURE_UNICODE_WCHAR_T,
1023   XML_FEATURE_DTD,
1024   XML_FEATURE_CONTEXT_BYTES,
1025   XML_FEATURE_MIN_SIZE,
1026   XML_FEATURE_SIZEOF_XML_CHAR,
1027   XML_FEATURE_SIZEOF_XML_LCHAR,
1028   XML_FEATURE_NS,
1029   XML_FEATURE_LARGE_SIZE,
1030   XML_FEATURE_ATTR_INFO,
1031   /* Added in Expat 2.4.0. */
1032   XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT,
1033   XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT,
1034   /* Added in Expat 2.6.0. */
1035   XML_FEATURE_GE
1036   /* Additional features must be added to the end of this enum. */
1037 };
1038 
1039 typedef struct {
1040   enum XML_FeatureEnum feature;
1041   const XML_LChar *name;
1042   long int value;
1043 } XML_Feature;
1044 
1045 XMLPARSEAPI(const XML_Feature *)
1046 XML_GetFeatureList(void);
1047 
1048 #if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
1049 /* Added in Expat 2.4.0 for XML_DTD defined and
1050  * added in Expat 2.6.0 for XML_GE == 1. */
1051 XMLPARSEAPI(XML_Bool)
1052 XML_SetBillionLaughsAttackProtectionMaximumAmplification(
1053     XML_Parser parser, float maximumAmplificationFactor);
1054 
1055 /* Added in Expat 2.4.0 for XML_DTD defined and
1056  * added in Expat 2.6.0 for XML_GE == 1. */
1057 XMLPARSEAPI(XML_Bool)
1058 XML_SetBillionLaughsAttackProtectionActivationThreshold(
1059     XML_Parser parser, unsigned long long activationThresholdBytes);
1060 #endif
1061 
1062 /* Added in Expat 2.6.0. */
1063 XMLPARSEAPI(XML_Bool)
1064 XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
1065 
1066 /* Expat follows the semantic versioning convention.
1067    See https://semver.org
1068 */
1069 #define XML_MAJOR_VERSION 2
1070 #define XML_MINOR_VERSION 6
1071 #define XML_MICRO_VERSION 4
1072 
1073 #ifdef __cplusplus
1074 }
1075 #endif
1076 
1077 #endif /* not Expat_INCLUDED */