xref: /freebsd/contrib/expat/lib/expat.h (revision 5bb6a25f8f50862853de4bdb01ecb4152f10d0e7)
15bb6a25fSPoul-Henning Kamp /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
25bb6a25fSPoul-Henning Kamp    See the file COPYING for copying permission.
35bb6a25fSPoul-Henning Kamp */
45bb6a25fSPoul-Henning Kamp 
55bb6a25fSPoul-Henning Kamp #ifndef XmlParse_INCLUDED
65bb6a25fSPoul-Henning Kamp #define XmlParse_INCLUDED 1
75bb6a25fSPoul-Henning Kamp 
85bb6a25fSPoul-Henning Kamp #ifdef __VMS
95bb6a25fSPoul-Henning Kamp /*      0        1         2         3      0        1         2         3
105bb6a25fSPoul-Henning Kamp         1234567890123456789012345678901     1234567890123456789012345678901 */
115bb6a25fSPoul-Henning Kamp #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
125bb6a25fSPoul-Henning Kamp #define XML_SetUnparsedEntityDeclHandler    XML_SetUnparsedEntDeclHandler
135bb6a25fSPoul-Henning Kamp #define XML_SetStartNamespaceDeclHandler    XML_SetStartNamespcDeclHandler
145bb6a25fSPoul-Henning Kamp #define XML_SetExternalEntityRefHandlerArg  XML_SetExternalEntRefHandlerArg
155bb6a25fSPoul-Henning Kamp #endif
165bb6a25fSPoul-Henning Kamp 
175bb6a25fSPoul-Henning Kamp #include <stdlib.h>
185bb6a25fSPoul-Henning Kamp 
195bb6a25fSPoul-Henning Kamp #ifndef XMLPARSEAPI
205bb6a25fSPoul-Henning Kamp #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
215bb6a25fSPoul-Henning Kamp #ifdef _STATIC
225bb6a25fSPoul-Henning Kamp #define XMLPARSEAPI(type) type __cdecl
235bb6a25fSPoul-Henning Kamp #else
245bb6a25fSPoul-Henning Kamp #define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl
255bb6a25fSPoul-Henning Kamp #endif
265bb6a25fSPoul-Henning Kamp #else
275bb6a25fSPoul-Henning Kamp #define XMLPARSEAPI(type) type
285bb6a25fSPoul-Henning Kamp #endif
295bb6a25fSPoul-Henning Kamp #endif  /* not defined XMLPARSEAPI */
305bb6a25fSPoul-Henning Kamp 
315bb6a25fSPoul-Henning Kamp #ifdef __cplusplus
325bb6a25fSPoul-Henning Kamp extern "C" {
335bb6a25fSPoul-Henning Kamp #endif
345bb6a25fSPoul-Henning Kamp 
355bb6a25fSPoul-Henning Kamp #ifdef XML_UNICODE_WCHAR_T
365bb6a25fSPoul-Henning Kamp #define XML_UNICODE
375bb6a25fSPoul-Henning Kamp #endif
385bb6a25fSPoul-Henning Kamp 
395bb6a25fSPoul-Henning Kamp struct XML_ParserStruct;
405bb6a25fSPoul-Henning Kamp typedef struct XML_ParserStruct *XML_Parser;
415bb6a25fSPoul-Henning Kamp 
425bb6a25fSPoul-Henning Kamp #ifdef XML_UNICODE     /* Information is UTF-16 encoded. */
435bb6a25fSPoul-Henning Kamp #ifdef XML_UNICODE_WCHAR_T
445bb6a25fSPoul-Henning Kamp typedef wchar_t XML_Char;
455bb6a25fSPoul-Henning Kamp typedef wchar_t XML_LChar;
465bb6a25fSPoul-Henning Kamp #else
475bb6a25fSPoul-Henning Kamp typedef unsigned short XML_Char;
485bb6a25fSPoul-Henning Kamp typedef char XML_LChar;
495bb6a25fSPoul-Henning Kamp #endif /* XML_UNICODE_WCHAR_T */
505bb6a25fSPoul-Henning Kamp #else                  /* Information is UTF-8 encoded. */
515bb6a25fSPoul-Henning Kamp typedef char XML_Char;
525bb6a25fSPoul-Henning Kamp typedef char XML_LChar;
535bb6a25fSPoul-Henning Kamp #endif /* XML_UNICODE */
545bb6a25fSPoul-Henning Kamp 
555bb6a25fSPoul-Henning Kamp /* Should this be defined using stdbool.h when C99 is available? */
565bb6a25fSPoul-Henning Kamp typedef unsigned char XML_Bool;
575bb6a25fSPoul-Henning Kamp #define XML_TRUE   ((XML_Bool) 1)
585bb6a25fSPoul-Henning Kamp #define XML_FALSE  ((XML_Bool) 0)
595bb6a25fSPoul-Henning Kamp 
605bb6a25fSPoul-Henning Kamp enum XML_Error {
615bb6a25fSPoul-Henning Kamp   XML_ERROR_NONE,
625bb6a25fSPoul-Henning Kamp   XML_ERROR_NO_MEMORY,
635bb6a25fSPoul-Henning Kamp   XML_ERROR_SYNTAX,
645bb6a25fSPoul-Henning Kamp   XML_ERROR_NO_ELEMENTS,
655bb6a25fSPoul-Henning Kamp   XML_ERROR_INVALID_TOKEN,
665bb6a25fSPoul-Henning Kamp   XML_ERROR_UNCLOSED_TOKEN,
675bb6a25fSPoul-Henning Kamp   XML_ERROR_PARTIAL_CHAR,
685bb6a25fSPoul-Henning Kamp   XML_ERROR_TAG_MISMATCH,
695bb6a25fSPoul-Henning Kamp   XML_ERROR_DUPLICATE_ATTRIBUTE,
705bb6a25fSPoul-Henning Kamp   XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
715bb6a25fSPoul-Henning Kamp   XML_ERROR_PARAM_ENTITY_REF,
725bb6a25fSPoul-Henning Kamp   XML_ERROR_UNDEFINED_ENTITY,
735bb6a25fSPoul-Henning Kamp   XML_ERROR_RECURSIVE_ENTITY_REF,
745bb6a25fSPoul-Henning Kamp   XML_ERROR_ASYNC_ENTITY,
755bb6a25fSPoul-Henning Kamp   XML_ERROR_BAD_CHAR_REF,
765bb6a25fSPoul-Henning Kamp   XML_ERROR_BINARY_ENTITY_REF,
775bb6a25fSPoul-Henning Kamp   XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
785bb6a25fSPoul-Henning Kamp   XML_ERROR_MISPLACED_XML_PI,
795bb6a25fSPoul-Henning Kamp   XML_ERROR_UNKNOWN_ENCODING,
805bb6a25fSPoul-Henning Kamp   XML_ERROR_INCORRECT_ENCODING,
815bb6a25fSPoul-Henning Kamp   XML_ERROR_UNCLOSED_CDATA_SECTION,
825bb6a25fSPoul-Henning Kamp   XML_ERROR_EXTERNAL_ENTITY_HANDLING,
835bb6a25fSPoul-Henning Kamp   XML_ERROR_NOT_STANDALONE,
845bb6a25fSPoul-Henning Kamp   XML_ERROR_UNEXPECTED_STATE,
855bb6a25fSPoul-Henning Kamp   XML_ERROR_ENTITY_DECLARED_IN_PE,
865bb6a25fSPoul-Henning Kamp   XML_ERROR_FEATURE_REQUIRES_XML_DTD,
875bb6a25fSPoul-Henning Kamp   XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
885bb6a25fSPoul-Henning Kamp };
895bb6a25fSPoul-Henning Kamp 
905bb6a25fSPoul-Henning Kamp enum XML_Content_Type {
915bb6a25fSPoul-Henning Kamp   XML_CTYPE_EMPTY = 1,
925bb6a25fSPoul-Henning Kamp   XML_CTYPE_ANY,
935bb6a25fSPoul-Henning Kamp   XML_CTYPE_MIXED,
945bb6a25fSPoul-Henning Kamp   XML_CTYPE_NAME,
955bb6a25fSPoul-Henning Kamp   XML_CTYPE_CHOICE,
965bb6a25fSPoul-Henning Kamp   XML_CTYPE_SEQ
975bb6a25fSPoul-Henning Kamp };
985bb6a25fSPoul-Henning Kamp 
995bb6a25fSPoul-Henning Kamp enum XML_Content_Quant {
1005bb6a25fSPoul-Henning Kamp   XML_CQUANT_NONE,
1015bb6a25fSPoul-Henning Kamp   XML_CQUANT_OPT,
1025bb6a25fSPoul-Henning Kamp   XML_CQUANT_REP,
1035bb6a25fSPoul-Henning Kamp   XML_CQUANT_PLUS
1045bb6a25fSPoul-Henning Kamp };
1055bb6a25fSPoul-Henning Kamp 
1065bb6a25fSPoul-Henning Kamp /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
1075bb6a25fSPoul-Henning Kamp    XML_CQUANT_NONE, and the other fields will be zero or NULL.
1085bb6a25fSPoul-Henning Kamp    If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
1095bb6a25fSPoul-Henning Kamp    numchildren will contain number of elements that may be mixed in
1105bb6a25fSPoul-Henning Kamp    and children point to an array of XML_Content cells that will be
1115bb6a25fSPoul-Henning Kamp    all of XML_CTYPE_NAME type with no quantification.
1125bb6a25fSPoul-Henning Kamp 
1135bb6a25fSPoul-Henning Kamp    If type == XML_CTYPE_NAME, then the name points to the name, and
1145bb6a25fSPoul-Henning Kamp    the numchildren field will be zero and children will be NULL. The
1155bb6a25fSPoul-Henning Kamp    quant fields indicates any quantifiers placed on the name.
1165bb6a25fSPoul-Henning Kamp 
1175bb6a25fSPoul-Henning Kamp    CHOICE and SEQ will have name NULL, the number of children in
1185bb6a25fSPoul-Henning Kamp    numchildren and children will point, recursively, to an array
1195bb6a25fSPoul-Henning Kamp    of XML_Content cells.
1205bb6a25fSPoul-Henning Kamp 
1215bb6a25fSPoul-Henning Kamp    The EMPTY, ANY, and MIXED types will only occur at top level.
1225bb6a25fSPoul-Henning Kamp */
1235bb6a25fSPoul-Henning Kamp 
1245bb6a25fSPoul-Henning Kamp typedef struct XML_cp XML_Content;
1255bb6a25fSPoul-Henning Kamp 
1265bb6a25fSPoul-Henning Kamp struct XML_cp {
1275bb6a25fSPoul-Henning Kamp   enum XML_Content_Type         type;
1285bb6a25fSPoul-Henning Kamp   enum XML_Content_Quant        quant;
1295bb6a25fSPoul-Henning Kamp   XML_Char *                    name;
1305bb6a25fSPoul-Henning Kamp   unsigned int                  numchildren;
1315bb6a25fSPoul-Henning Kamp   XML_Content *                 children;
1325bb6a25fSPoul-Henning Kamp };
1335bb6a25fSPoul-Henning Kamp 
1345bb6a25fSPoul-Henning Kamp 
1355bb6a25fSPoul-Henning Kamp /* This is called for an element declaration. See above for
1365bb6a25fSPoul-Henning Kamp    description of the model argument. It's the caller's responsibility
1375bb6a25fSPoul-Henning Kamp    to free model when finished with it.
1385bb6a25fSPoul-Henning Kamp */
1395bb6a25fSPoul-Henning Kamp typedef void (*XML_ElementDeclHandler) (void *userData,
1405bb6a25fSPoul-Henning Kamp                                         const XML_Char *name,
1415bb6a25fSPoul-Henning Kamp                                         XML_Content *model);
1425bb6a25fSPoul-Henning Kamp 
1435bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
1445bb6a25fSPoul-Henning Kamp XML_SetElementDeclHandler(XML_Parser parser,
1455bb6a25fSPoul-Henning Kamp                           XML_ElementDeclHandler eldecl);
1465bb6a25fSPoul-Henning Kamp 
1475bb6a25fSPoul-Henning Kamp /* The Attlist declaration handler is called for *each* attribute. So
1485bb6a25fSPoul-Henning Kamp    a single Attlist declaration with multiple attributes declared will
1495bb6a25fSPoul-Henning Kamp    generate multiple calls to this handler. The "default" parameter
1505bb6a25fSPoul-Henning Kamp    may be NULL in the case of the "#IMPLIED" or "#REQUIRED"
1515bb6a25fSPoul-Henning Kamp    keyword. The "isrequired" parameter will be true and the default
1525bb6a25fSPoul-Henning Kamp    value will be NULL in the case of "#REQUIRED". If "isrequired" is
1535bb6a25fSPoul-Henning Kamp    true and default is non-NULL, then this is a "#FIXED" default.
1545bb6a25fSPoul-Henning Kamp */
1555bb6a25fSPoul-Henning Kamp typedef void (*XML_AttlistDeclHandler) (void           *userData,
1565bb6a25fSPoul-Henning Kamp                                         const XML_Char *elname,
1575bb6a25fSPoul-Henning Kamp                                         const XML_Char *attname,
1585bb6a25fSPoul-Henning Kamp                                         const XML_Char *att_type,
1595bb6a25fSPoul-Henning Kamp                                         const XML_Char *dflt,
1605bb6a25fSPoul-Henning Kamp                                         int             isrequired);
1615bb6a25fSPoul-Henning Kamp 
1625bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
1635bb6a25fSPoul-Henning Kamp XML_SetAttlistDeclHandler(XML_Parser parser,
1645bb6a25fSPoul-Henning Kamp                           XML_AttlistDeclHandler attdecl);
1655bb6a25fSPoul-Henning Kamp 
1665bb6a25fSPoul-Henning Kamp /* The XML declaration handler is called for *both* XML declarations
1675bb6a25fSPoul-Henning Kamp    and text declarations. The way to distinguish is that the version
1685bb6a25fSPoul-Henning Kamp    parameter will be NULL for text declarations. The encoding
1695bb6a25fSPoul-Henning Kamp    parameter may be NULL for XML declarations. The standalone
1705bb6a25fSPoul-Henning Kamp    parameter will be -1, 0, or 1 indicating respectively that there
1715bb6a25fSPoul-Henning Kamp    was no standalone parameter in the declaration, that it was given
1725bb6a25fSPoul-Henning Kamp    as no, or that it was given as yes.
1735bb6a25fSPoul-Henning Kamp */
1745bb6a25fSPoul-Henning Kamp typedef void (*XML_XmlDeclHandler) (void                *userData,
1755bb6a25fSPoul-Henning Kamp                                     const XML_Char      *version,
1765bb6a25fSPoul-Henning Kamp                                     const XML_Char      *encoding,
1775bb6a25fSPoul-Henning Kamp                                     int                  standalone);
1785bb6a25fSPoul-Henning Kamp 
1795bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
1805bb6a25fSPoul-Henning Kamp XML_SetXmlDeclHandler(XML_Parser parser,
1815bb6a25fSPoul-Henning Kamp                       XML_XmlDeclHandler xmldecl);
1825bb6a25fSPoul-Henning Kamp 
1835bb6a25fSPoul-Henning Kamp 
1845bb6a25fSPoul-Henning Kamp typedef struct {
1855bb6a25fSPoul-Henning Kamp   void *(*malloc_fcn)(size_t size);
1865bb6a25fSPoul-Henning Kamp   void *(*realloc_fcn)(void *ptr, size_t size);
1875bb6a25fSPoul-Henning Kamp   void (*free_fcn)(void *ptr);
1885bb6a25fSPoul-Henning Kamp } XML_Memory_Handling_Suite;
1895bb6a25fSPoul-Henning Kamp 
1905bb6a25fSPoul-Henning Kamp /* Constructs a new parser; encoding is the encoding specified by the
1915bb6a25fSPoul-Henning Kamp    external protocol or NULL if there is none specified.
1925bb6a25fSPoul-Henning Kamp */
1935bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Parser)
1945bb6a25fSPoul-Henning Kamp XML_ParserCreate(const XML_Char *encoding);
1955bb6a25fSPoul-Henning Kamp 
1965bb6a25fSPoul-Henning Kamp /* Constructs a new parser and namespace processor.  Element type
1975bb6a25fSPoul-Henning Kamp    names and attribute names that belong to a namespace will be
1985bb6a25fSPoul-Henning Kamp    expanded; unprefixed attribute names are never expanded; unprefixed
1995bb6a25fSPoul-Henning Kamp    element type names are expanded only if there is a default
2005bb6a25fSPoul-Henning Kamp    namespace. The expanded name is the concatenation of the namespace
2015bb6a25fSPoul-Henning Kamp    URI, the namespace separator character, and the local part of the
2025bb6a25fSPoul-Henning Kamp    name.  If the namespace separator is '\0' then the namespace URI
2035bb6a25fSPoul-Henning Kamp    and the local part will be concatenated without any separator.
2045bb6a25fSPoul-Henning Kamp    When a namespace is not declared, the name and prefix will be
2055bb6a25fSPoul-Henning Kamp    passed through without expansion.
2065bb6a25fSPoul-Henning Kamp */
2075bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Parser)
2085bb6a25fSPoul-Henning Kamp XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
2095bb6a25fSPoul-Henning Kamp 
2105bb6a25fSPoul-Henning Kamp 
2115bb6a25fSPoul-Henning Kamp /* Constructs a new parser using the memory management suit referred to
2125bb6a25fSPoul-Henning Kamp    by memsuite. If memsuite is NULL, then use the standard library memory
2135bb6a25fSPoul-Henning Kamp    suite. If namespaceSeparator is non-NULL it creates a parser with
2145bb6a25fSPoul-Henning Kamp    namespace processing as described above. The character pointed at
2155bb6a25fSPoul-Henning Kamp    will serve as the namespace separator.
2165bb6a25fSPoul-Henning Kamp 
2175bb6a25fSPoul-Henning Kamp    All further memory operations used for the created parser will come from
2185bb6a25fSPoul-Henning Kamp    the given suite.
2195bb6a25fSPoul-Henning Kamp */
2205bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Parser)
2215bb6a25fSPoul-Henning Kamp XML_ParserCreate_MM(const XML_Char *encoding,
2225bb6a25fSPoul-Henning Kamp                     const XML_Memory_Handling_Suite *memsuite,
2235bb6a25fSPoul-Henning Kamp                     const XML_Char *namespaceSeparator);
2245bb6a25fSPoul-Henning Kamp 
2255bb6a25fSPoul-Henning Kamp /* Prepare a parser object to be re-used.  This is particularly
2265bb6a25fSPoul-Henning Kamp    valuable when memory allocation overhead is disproportionatly high,
2275bb6a25fSPoul-Henning Kamp    such as when a large number of small documnents need to be parsed.
2285bb6a25fSPoul-Henning Kamp    All handlers are cleared from the parser, except for the
2295bb6a25fSPoul-Henning Kamp    unknownEncodingHandler. The parser's external state is re-initialized
2305bb6a25fSPoul-Henning Kamp    except for the values of ns and ns_triplets.
2315bb6a25fSPoul-Henning Kamp 
2325bb6a25fSPoul-Henning Kamp    Added in Expat 1.95.3.
2335bb6a25fSPoul-Henning Kamp */
2345bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Bool)
2355bb6a25fSPoul-Henning Kamp XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
2365bb6a25fSPoul-Henning Kamp 
2375bb6a25fSPoul-Henning Kamp /* atts is array of name/value pairs, terminated by 0;
2385bb6a25fSPoul-Henning Kamp    names and values are 0 terminated.
2395bb6a25fSPoul-Henning Kamp */
2405bb6a25fSPoul-Henning Kamp typedef void (*XML_StartElementHandler)(void *userData,
2415bb6a25fSPoul-Henning Kamp                                         const XML_Char *name,
2425bb6a25fSPoul-Henning Kamp                                         const XML_Char **atts);
2435bb6a25fSPoul-Henning Kamp 
2445bb6a25fSPoul-Henning Kamp typedef void (*XML_EndElementHandler)(void *userData,
2455bb6a25fSPoul-Henning Kamp                                       const XML_Char *name);
2465bb6a25fSPoul-Henning Kamp 
2475bb6a25fSPoul-Henning Kamp 
2485bb6a25fSPoul-Henning Kamp /* s is not 0 terminated. */
2495bb6a25fSPoul-Henning Kamp typedef void (*XML_CharacterDataHandler)(void *userData,
2505bb6a25fSPoul-Henning Kamp                                          const XML_Char *s,
2515bb6a25fSPoul-Henning Kamp                                          int len);
2525bb6a25fSPoul-Henning Kamp 
2535bb6a25fSPoul-Henning Kamp /* target and data are 0 terminated */
2545bb6a25fSPoul-Henning Kamp typedef void (*XML_ProcessingInstructionHandler)(void *userData,
2555bb6a25fSPoul-Henning Kamp                                                  const XML_Char *target,
2565bb6a25fSPoul-Henning Kamp                                                  const XML_Char *data);
2575bb6a25fSPoul-Henning Kamp 
2585bb6a25fSPoul-Henning Kamp /* data is 0 terminated */
2595bb6a25fSPoul-Henning Kamp typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
2605bb6a25fSPoul-Henning Kamp 
2615bb6a25fSPoul-Henning Kamp typedef void (*XML_StartCdataSectionHandler)(void *userData);
2625bb6a25fSPoul-Henning Kamp typedef void (*XML_EndCdataSectionHandler)(void *userData);
2635bb6a25fSPoul-Henning Kamp 
2645bb6a25fSPoul-Henning Kamp /* This is called for any characters in the XML document for which
2655bb6a25fSPoul-Henning Kamp    there is no applicable handler.  This includes both characters that
2665bb6a25fSPoul-Henning Kamp    are part of markup which is of a kind that is not reported
2675bb6a25fSPoul-Henning Kamp    (comments, markup declarations), or characters that are part of a
2685bb6a25fSPoul-Henning Kamp    construct which could be reported but for which no handler has been
2695bb6a25fSPoul-Henning Kamp    supplied. The characters are passed exactly as they were in the XML
2705bb6a25fSPoul-Henning Kamp    document except that they will be encoded in UTF-8 or UTF-16.
2715bb6a25fSPoul-Henning Kamp    Line boundaries are not normalized. Note that a byte order mark
2725bb6a25fSPoul-Henning Kamp    character is not passed to the default handler. There are no
2735bb6a25fSPoul-Henning Kamp    guarantees about how characters are divided between calls to the
2745bb6a25fSPoul-Henning Kamp    default handler: for example, a comment might be split between
2755bb6a25fSPoul-Henning Kamp    multiple calls.
2765bb6a25fSPoul-Henning Kamp */
2775bb6a25fSPoul-Henning Kamp typedef void (*XML_DefaultHandler)(void *userData,
2785bb6a25fSPoul-Henning Kamp                                    const XML_Char *s,
2795bb6a25fSPoul-Henning Kamp                                    int len);
2805bb6a25fSPoul-Henning Kamp 
2815bb6a25fSPoul-Henning Kamp /* This is called for the start of the DOCTYPE declaration, before
2825bb6a25fSPoul-Henning Kamp    any DTD or internal subset is parsed.
2835bb6a25fSPoul-Henning Kamp */
2845bb6a25fSPoul-Henning Kamp typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
2855bb6a25fSPoul-Henning Kamp                                             const XML_Char *doctypeName,
2865bb6a25fSPoul-Henning Kamp                                             const XML_Char *sysid,
2875bb6a25fSPoul-Henning Kamp                                             const XML_Char *pubid,
2885bb6a25fSPoul-Henning Kamp                                             int has_internal_subset);
2895bb6a25fSPoul-Henning Kamp 
2905bb6a25fSPoul-Henning Kamp /* This is called for the start of the DOCTYPE declaration when the
2915bb6a25fSPoul-Henning Kamp    closing > is encountered, but after processing any external
2925bb6a25fSPoul-Henning Kamp    subset.
2935bb6a25fSPoul-Henning Kamp */
2945bb6a25fSPoul-Henning Kamp typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
2955bb6a25fSPoul-Henning Kamp 
2965bb6a25fSPoul-Henning Kamp /* This is called for entity declarations. The is_parameter_entity
2975bb6a25fSPoul-Henning Kamp    argument will be non-zero if the entity is a parameter entity, zero
2985bb6a25fSPoul-Henning Kamp    otherwise.
2995bb6a25fSPoul-Henning Kamp 
3005bb6a25fSPoul-Henning Kamp    For internal entities (<!ENTITY foo "bar">), value will
3015bb6a25fSPoul-Henning Kamp    be non-NULL and systemId, publicID, and notationName will be NULL.
3025bb6a25fSPoul-Henning Kamp    The value string is NOT nul-terminated; the length is provided in
3035bb6a25fSPoul-Henning Kamp    the value_length argument. Since it is legal to have zero-length
3045bb6a25fSPoul-Henning Kamp    values, do not use this argument to test for internal entities.
3055bb6a25fSPoul-Henning Kamp 
3065bb6a25fSPoul-Henning Kamp    For external entities, value will be NULL and systemId will be
3075bb6a25fSPoul-Henning Kamp    non-NULL. The publicId argument will be NULL unless a public
3085bb6a25fSPoul-Henning Kamp    identifier was provided. The notationName argument will have a
3095bb6a25fSPoul-Henning Kamp    non-NULL value only for unparsed entity declarations.
3105bb6a25fSPoul-Henning Kamp 
3115bb6a25fSPoul-Henning Kamp    Note that is_parameter_entity can't be changed to XML_Bool, since
3125bb6a25fSPoul-Henning Kamp    that would break binary compatibility.
3135bb6a25fSPoul-Henning Kamp */
3145bb6a25fSPoul-Henning Kamp typedef void (*XML_EntityDeclHandler) (void *userData,
3155bb6a25fSPoul-Henning Kamp                                        const XML_Char *entityName,
3165bb6a25fSPoul-Henning Kamp                                        int is_parameter_entity,
3175bb6a25fSPoul-Henning Kamp                                        const XML_Char *value,
3185bb6a25fSPoul-Henning Kamp                                        int value_length,
3195bb6a25fSPoul-Henning Kamp                                        const XML_Char *base,
3205bb6a25fSPoul-Henning Kamp                                        const XML_Char *systemId,
3215bb6a25fSPoul-Henning Kamp                                        const XML_Char *publicId,
3225bb6a25fSPoul-Henning Kamp                                        const XML_Char *notationName);
3235bb6a25fSPoul-Henning Kamp 
3245bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
3255bb6a25fSPoul-Henning Kamp XML_SetEntityDeclHandler(XML_Parser parser,
3265bb6a25fSPoul-Henning Kamp                          XML_EntityDeclHandler handler);
3275bb6a25fSPoul-Henning Kamp 
3285bb6a25fSPoul-Henning Kamp /* OBSOLETE -- OBSOLETE -- OBSOLETE
3295bb6a25fSPoul-Henning Kamp    This handler has been superceded by the EntityDeclHandler above.
3305bb6a25fSPoul-Henning Kamp    It is provided here for backward compatibility.
3315bb6a25fSPoul-Henning Kamp 
3325bb6a25fSPoul-Henning Kamp    This is called for a declaration of an unparsed (NDATA) entity.
3335bb6a25fSPoul-Henning Kamp    The base argument is whatever was set by XML_SetBase. The
3345bb6a25fSPoul-Henning Kamp    entityName, systemId and notationName arguments will never be
3355bb6a25fSPoul-Henning Kamp    NULL. The other arguments may be.
3365bb6a25fSPoul-Henning Kamp */
3375bb6a25fSPoul-Henning Kamp typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
3385bb6a25fSPoul-Henning Kamp                                               const XML_Char *entityName,
3395bb6a25fSPoul-Henning Kamp                                               const XML_Char *base,
3405bb6a25fSPoul-Henning Kamp                                               const XML_Char *systemId,
3415bb6a25fSPoul-Henning Kamp                                               const XML_Char *publicId,
3425bb6a25fSPoul-Henning Kamp                                               const XML_Char *notationName);
3435bb6a25fSPoul-Henning Kamp 
3445bb6a25fSPoul-Henning Kamp /* This is called for a declaration of notation.  The base argument is
3455bb6a25fSPoul-Henning Kamp    whatever was set by XML_SetBase. The notationName will never be
3465bb6a25fSPoul-Henning Kamp    NULL.  The other arguments can be.
3475bb6a25fSPoul-Henning Kamp */
3485bb6a25fSPoul-Henning Kamp typedef void (*XML_NotationDeclHandler)(void *userData,
3495bb6a25fSPoul-Henning Kamp                                         const XML_Char *notationName,
3505bb6a25fSPoul-Henning Kamp                                         const XML_Char *base,
3515bb6a25fSPoul-Henning Kamp                                         const XML_Char *systemId,
3525bb6a25fSPoul-Henning Kamp                                         const XML_Char *publicId);
3535bb6a25fSPoul-Henning Kamp 
3545bb6a25fSPoul-Henning Kamp /* When namespace processing is enabled, these are called once for
3555bb6a25fSPoul-Henning Kamp    each namespace declaration. The call to the start and end element
3565bb6a25fSPoul-Henning Kamp    handlers occur between the calls to the start and end namespace
3575bb6a25fSPoul-Henning Kamp    declaration handlers. For an xmlns attribute, prefix will be
3585bb6a25fSPoul-Henning Kamp    NULL.  For an xmlns="" attribute, uri will be NULL.
3595bb6a25fSPoul-Henning Kamp */
3605bb6a25fSPoul-Henning Kamp typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
3615bb6a25fSPoul-Henning Kamp                                               const XML_Char *prefix,
3625bb6a25fSPoul-Henning Kamp                                               const XML_Char *uri);
3635bb6a25fSPoul-Henning Kamp 
3645bb6a25fSPoul-Henning Kamp typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
3655bb6a25fSPoul-Henning Kamp                                             const XML_Char *prefix);
3665bb6a25fSPoul-Henning Kamp 
3675bb6a25fSPoul-Henning Kamp /* This is called if the document is not standalone, that is, it has an
3685bb6a25fSPoul-Henning Kamp    external subset or a reference to a parameter entity, but does not
3695bb6a25fSPoul-Henning Kamp    have standalone="yes". If this handler returns 0, then processing
3705bb6a25fSPoul-Henning Kamp    will not continue, and the parser will return a
3715bb6a25fSPoul-Henning Kamp    XML_ERROR_NOT_STANDALONE error.
3725bb6a25fSPoul-Henning Kamp    If parameter entity parsing is enabled, then in addition to the
3735bb6a25fSPoul-Henning Kamp    conditions above this handler will only be called if the referenced
3745bb6a25fSPoul-Henning Kamp    entity was actually read.
3755bb6a25fSPoul-Henning Kamp */
3765bb6a25fSPoul-Henning Kamp typedef int (*XML_NotStandaloneHandler)(void *userData);
3775bb6a25fSPoul-Henning Kamp 
3785bb6a25fSPoul-Henning Kamp /* This is called for a reference to an external parsed general
3795bb6a25fSPoul-Henning Kamp    entity.  The referenced entity is not automatically parsed.  The
3805bb6a25fSPoul-Henning Kamp    application can parse it immediately or later using
3815bb6a25fSPoul-Henning Kamp    XML_ExternalEntityParserCreate.
3825bb6a25fSPoul-Henning Kamp 
3835bb6a25fSPoul-Henning Kamp    The parser argument is the parser parsing the entity containing the
3845bb6a25fSPoul-Henning Kamp    reference; it can be passed as the parser argument to
3855bb6a25fSPoul-Henning Kamp    XML_ExternalEntityParserCreate.  The systemId argument is the
3865bb6a25fSPoul-Henning Kamp    system identifier as specified in the entity declaration; it will
3875bb6a25fSPoul-Henning Kamp    not be NULL.
3885bb6a25fSPoul-Henning Kamp 
3895bb6a25fSPoul-Henning Kamp    The base argument is the system identifier that should be used as
3905bb6a25fSPoul-Henning Kamp    the base for resolving systemId if systemId was relative; this is
3915bb6a25fSPoul-Henning Kamp    set by XML_SetBase; it may be NULL.
3925bb6a25fSPoul-Henning Kamp 
3935bb6a25fSPoul-Henning Kamp    The publicId argument is the public identifier as specified in the
3945bb6a25fSPoul-Henning Kamp    entity declaration, or NULL if none was specified; the whitespace
3955bb6a25fSPoul-Henning Kamp    in the public identifier will have been normalized as required by
3965bb6a25fSPoul-Henning Kamp    the XML spec.
3975bb6a25fSPoul-Henning Kamp 
3985bb6a25fSPoul-Henning Kamp    The context argument specifies the parsing context in the format
3995bb6a25fSPoul-Henning Kamp    expected by the context argument to XML_ExternalEntityParserCreate;
4005bb6a25fSPoul-Henning Kamp    context is valid only until the handler returns, so if the
4015bb6a25fSPoul-Henning Kamp    referenced entity is to be parsed later, it must be copied.
4025bb6a25fSPoul-Henning Kamp 
4035bb6a25fSPoul-Henning Kamp    The handler should return 0 if processing should not continue
4045bb6a25fSPoul-Henning Kamp    because of a fatal error in the handling of the external entity.
4055bb6a25fSPoul-Henning Kamp    In this case the calling parser will return an
4065bb6a25fSPoul-Henning Kamp    XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
4075bb6a25fSPoul-Henning Kamp 
4085bb6a25fSPoul-Henning Kamp    Note that unlike other handlers the first argument is the parser,
4095bb6a25fSPoul-Henning Kamp    not userData.
4105bb6a25fSPoul-Henning Kamp */
4115bb6a25fSPoul-Henning Kamp typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
4125bb6a25fSPoul-Henning Kamp                                             const XML_Char *context,
4135bb6a25fSPoul-Henning Kamp                                             const XML_Char *base,
4145bb6a25fSPoul-Henning Kamp                                             const XML_Char *systemId,
4155bb6a25fSPoul-Henning Kamp                                             const XML_Char *publicId);
4165bb6a25fSPoul-Henning Kamp 
4175bb6a25fSPoul-Henning Kamp /* This is called in two situations:
4185bb6a25fSPoul-Henning Kamp    1) An entity reference is encountered for which no declaration
4195bb6a25fSPoul-Henning Kamp       has been read *and* this is not an error.
4205bb6a25fSPoul-Henning Kamp    2) An internal entity reference is read, but not expanded, because
4215bb6a25fSPoul-Henning Kamp       XML_SetDefaultHandler has been called.
4225bb6a25fSPoul-Henning Kamp    Note: skipped parameter entities in declarations and skipped general
4235bb6a25fSPoul-Henning Kamp          entities in attribute values cannot be reported, because
4245bb6a25fSPoul-Henning Kamp          the event would be out of sync with the reporting of the
4255bb6a25fSPoul-Henning Kamp          declarations or attribute values
4265bb6a25fSPoul-Henning Kamp */
4275bb6a25fSPoul-Henning Kamp typedef void (*XML_SkippedEntityHandler)(void *userData,
4285bb6a25fSPoul-Henning Kamp                                          const XML_Char *entityName,
4295bb6a25fSPoul-Henning Kamp                                          int is_parameter_entity);
4305bb6a25fSPoul-Henning Kamp 
4315bb6a25fSPoul-Henning Kamp /* This structure is filled in by the XML_UnknownEncodingHandler to
4325bb6a25fSPoul-Henning Kamp    provide information to the parser about encodings that are unknown
4335bb6a25fSPoul-Henning Kamp    to the parser.
4345bb6a25fSPoul-Henning Kamp 
4355bb6a25fSPoul-Henning Kamp    The map[b] member gives information about byte sequences whose
4365bb6a25fSPoul-Henning Kamp    first byte is b.
4375bb6a25fSPoul-Henning Kamp 
4385bb6a25fSPoul-Henning Kamp    If map[b] is c where c is >= 0, then b by itself encodes the
4395bb6a25fSPoul-Henning Kamp    Unicode scalar value c.
4405bb6a25fSPoul-Henning Kamp 
4415bb6a25fSPoul-Henning Kamp    If map[b] is -1, then the byte sequence is malformed.
4425bb6a25fSPoul-Henning Kamp 
4435bb6a25fSPoul-Henning Kamp    If map[b] is -n, where n >= 2, then b is the first byte of an
4445bb6a25fSPoul-Henning Kamp    n-byte sequence that encodes a single Unicode scalar value.
4455bb6a25fSPoul-Henning Kamp 
4465bb6a25fSPoul-Henning Kamp    The data member will be passed as the first argument to the convert
4475bb6a25fSPoul-Henning Kamp    function.
4485bb6a25fSPoul-Henning Kamp 
4495bb6a25fSPoul-Henning Kamp    The convert function is used to convert multibyte sequences; s will
4505bb6a25fSPoul-Henning Kamp    point to a n-byte sequence where map[(unsigned char)*s] == -n.  The
4515bb6a25fSPoul-Henning Kamp    convert function must return the Unicode scalar value represented
4525bb6a25fSPoul-Henning Kamp    by this byte sequence or -1 if the byte sequence is malformed.
4535bb6a25fSPoul-Henning Kamp 
4545bb6a25fSPoul-Henning Kamp    The convert function may be NULL if the encoding is a single-byte
4555bb6a25fSPoul-Henning Kamp    encoding, that is if map[b] >= -1 for all bytes b.
4565bb6a25fSPoul-Henning Kamp 
4575bb6a25fSPoul-Henning Kamp    When the parser is finished with the encoding, then if release is
4585bb6a25fSPoul-Henning Kamp    not NULL, it will call release passing it the data member; once
4595bb6a25fSPoul-Henning Kamp    release has been called, the convert function will not be called
4605bb6a25fSPoul-Henning Kamp    again.
4615bb6a25fSPoul-Henning Kamp 
4625bb6a25fSPoul-Henning Kamp    Expat places certain restrictions on the encodings that are supported
4635bb6a25fSPoul-Henning Kamp    using this mechanism.
4645bb6a25fSPoul-Henning Kamp 
4655bb6a25fSPoul-Henning Kamp    1. Every ASCII character that can appear in a well-formed XML document,
4665bb6a25fSPoul-Henning Kamp       other than the characters
4675bb6a25fSPoul-Henning Kamp 
4685bb6a25fSPoul-Henning Kamp       $@\^`{}~
4695bb6a25fSPoul-Henning Kamp 
4705bb6a25fSPoul-Henning Kamp       must be represented by a single byte, and that byte must be the
4715bb6a25fSPoul-Henning Kamp       same byte that represents that character in ASCII.
4725bb6a25fSPoul-Henning Kamp 
4735bb6a25fSPoul-Henning Kamp    2. No character may require more than 4 bytes to encode.
4745bb6a25fSPoul-Henning Kamp 
4755bb6a25fSPoul-Henning Kamp    3. All characters encoded must have Unicode scalar values <=
4765bb6a25fSPoul-Henning Kamp       0xFFFF, (i.e., characters that would be encoded by surrogates in
4775bb6a25fSPoul-Henning Kamp       UTF-16 are  not allowed).  Note that this restriction doesn't
4785bb6a25fSPoul-Henning Kamp       apply to the built-in support for UTF-8 and UTF-16.
4795bb6a25fSPoul-Henning Kamp 
4805bb6a25fSPoul-Henning Kamp    4. No Unicode character may be encoded by more than one distinct
4815bb6a25fSPoul-Henning Kamp       sequence of bytes.
4825bb6a25fSPoul-Henning Kamp */
4835bb6a25fSPoul-Henning Kamp typedef struct {
4845bb6a25fSPoul-Henning Kamp   int map[256];
4855bb6a25fSPoul-Henning Kamp   void *data;
4865bb6a25fSPoul-Henning Kamp   int (*convert)(void *data, const char *s);
4875bb6a25fSPoul-Henning Kamp   void (*release)(void *data);
4885bb6a25fSPoul-Henning Kamp } XML_Encoding;
4895bb6a25fSPoul-Henning Kamp 
4905bb6a25fSPoul-Henning Kamp /* This is called for an encoding that is unknown to the parser.
4915bb6a25fSPoul-Henning Kamp 
4925bb6a25fSPoul-Henning Kamp    The encodingHandlerData argument is that which was passed as the
4935bb6a25fSPoul-Henning Kamp    second argument to XML_SetUnknownEncodingHandler.
4945bb6a25fSPoul-Henning Kamp 
4955bb6a25fSPoul-Henning Kamp    The name argument gives the name of the encoding as specified in
4965bb6a25fSPoul-Henning Kamp    the encoding declaration.
4975bb6a25fSPoul-Henning Kamp 
4985bb6a25fSPoul-Henning Kamp    If the callback can provide information about the encoding, it must
4995bb6a25fSPoul-Henning Kamp    fill in the XML_Encoding structure, and return 1.  Otherwise it
5005bb6a25fSPoul-Henning Kamp    must return 0.
5015bb6a25fSPoul-Henning Kamp 
5025bb6a25fSPoul-Henning Kamp    If info does not describe a suitable encoding, then the parser will
5035bb6a25fSPoul-Henning Kamp    return an XML_UNKNOWN_ENCODING error.
5045bb6a25fSPoul-Henning Kamp */
5055bb6a25fSPoul-Henning Kamp typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
5065bb6a25fSPoul-Henning Kamp                                           const XML_Char *name,
5075bb6a25fSPoul-Henning Kamp                                           XML_Encoding *info);
5085bb6a25fSPoul-Henning Kamp 
5095bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5105bb6a25fSPoul-Henning Kamp XML_SetElementHandler(XML_Parser parser,
5115bb6a25fSPoul-Henning Kamp                       XML_StartElementHandler start,
5125bb6a25fSPoul-Henning Kamp                       XML_EndElementHandler end);
5135bb6a25fSPoul-Henning Kamp 
5145bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5155bb6a25fSPoul-Henning Kamp XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
5165bb6a25fSPoul-Henning Kamp 
5175bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5185bb6a25fSPoul-Henning Kamp XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
5195bb6a25fSPoul-Henning Kamp 
5205bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5215bb6a25fSPoul-Henning Kamp XML_SetCharacterDataHandler(XML_Parser parser,
5225bb6a25fSPoul-Henning Kamp                             XML_CharacterDataHandler handler);
5235bb6a25fSPoul-Henning Kamp 
5245bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5255bb6a25fSPoul-Henning Kamp XML_SetProcessingInstructionHandler(XML_Parser parser,
5265bb6a25fSPoul-Henning Kamp                                     XML_ProcessingInstructionHandler handler);
5275bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5285bb6a25fSPoul-Henning Kamp XML_SetCommentHandler(XML_Parser parser,
5295bb6a25fSPoul-Henning Kamp                       XML_CommentHandler handler);
5305bb6a25fSPoul-Henning Kamp 
5315bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5325bb6a25fSPoul-Henning Kamp XML_SetCdataSectionHandler(XML_Parser parser,
5335bb6a25fSPoul-Henning Kamp                            XML_StartCdataSectionHandler start,
5345bb6a25fSPoul-Henning Kamp                            XML_EndCdataSectionHandler end);
5355bb6a25fSPoul-Henning Kamp 
5365bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5375bb6a25fSPoul-Henning Kamp XML_SetStartCdataSectionHandler(XML_Parser parser,
5385bb6a25fSPoul-Henning Kamp                                 XML_StartCdataSectionHandler start);
5395bb6a25fSPoul-Henning Kamp 
5405bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5415bb6a25fSPoul-Henning Kamp XML_SetEndCdataSectionHandler(XML_Parser parser,
5425bb6a25fSPoul-Henning Kamp                               XML_EndCdataSectionHandler end);
5435bb6a25fSPoul-Henning Kamp 
5445bb6a25fSPoul-Henning Kamp /* This sets the default handler and also inhibits expansion of
5455bb6a25fSPoul-Henning Kamp    internal entities. These entity references will be passed to the
5465bb6a25fSPoul-Henning Kamp    default handler, or to the skipped entity handler, if one is set.
5475bb6a25fSPoul-Henning Kamp */
5485bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5495bb6a25fSPoul-Henning Kamp XML_SetDefaultHandler(XML_Parser parser,
5505bb6a25fSPoul-Henning Kamp                       XML_DefaultHandler handler);
5515bb6a25fSPoul-Henning Kamp 
5525bb6a25fSPoul-Henning Kamp /* This sets the default handler but does not inhibit expansion of
5535bb6a25fSPoul-Henning Kamp    internal entities.  The entity reference will not be passed to the
5545bb6a25fSPoul-Henning Kamp    default handler.
5555bb6a25fSPoul-Henning Kamp */
5565bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5575bb6a25fSPoul-Henning Kamp XML_SetDefaultHandlerExpand(XML_Parser parser,
5585bb6a25fSPoul-Henning Kamp                             XML_DefaultHandler handler);
5595bb6a25fSPoul-Henning Kamp 
5605bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5615bb6a25fSPoul-Henning Kamp XML_SetDoctypeDeclHandler(XML_Parser parser,
5625bb6a25fSPoul-Henning Kamp                           XML_StartDoctypeDeclHandler start,
5635bb6a25fSPoul-Henning Kamp                           XML_EndDoctypeDeclHandler end);
5645bb6a25fSPoul-Henning Kamp 
5655bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5665bb6a25fSPoul-Henning Kamp XML_SetStartDoctypeDeclHandler(XML_Parser parser,
5675bb6a25fSPoul-Henning Kamp                                XML_StartDoctypeDeclHandler start);
5685bb6a25fSPoul-Henning Kamp 
5695bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5705bb6a25fSPoul-Henning Kamp XML_SetEndDoctypeDeclHandler(XML_Parser parser,
5715bb6a25fSPoul-Henning Kamp                              XML_EndDoctypeDeclHandler end);
5725bb6a25fSPoul-Henning Kamp 
5735bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5745bb6a25fSPoul-Henning Kamp XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
5755bb6a25fSPoul-Henning Kamp                                  XML_UnparsedEntityDeclHandler handler);
5765bb6a25fSPoul-Henning Kamp 
5775bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5785bb6a25fSPoul-Henning Kamp XML_SetNotationDeclHandler(XML_Parser parser,
5795bb6a25fSPoul-Henning Kamp                            XML_NotationDeclHandler handler);
5805bb6a25fSPoul-Henning Kamp 
5815bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5825bb6a25fSPoul-Henning Kamp XML_SetNamespaceDeclHandler(XML_Parser parser,
5835bb6a25fSPoul-Henning Kamp                             XML_StartNamespaceDeclHandler start,
5845bb6a25fSPoul-Henning Kamp                             XML_EndNamespaceDeclHandler end);
5855bb6a25fSPoul-Henning Kamp 
5865bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5875bb6a25fSPoul-Henning Kamp XML_SetStartNamespaceDeclHandler(XML_Parser parser,
5885bb6a25fSPoul-Henning Kamp                                  XML_StartNamespaceDeclHandler start);
5895bb6a25fSPoul-Henning Kamp 
5905bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5915bb6a25fSPoul-Henning Kamp XML_SetEndNamespaceDeclHandler(XML_Parser parser,
5925bb6a25fSPoul-Henning Kamp                                XML_EndNamespaceDeclHandler end);
5935bb6a25fSPoul-Henning Kamp 
5945bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5955bb6a25fSPoul-Henning Kamp XML_SetNotStandaloneHandler(XML_Parser parser,
5965bb6a25fSPoul-Henning Kamp                             XML_NotStandaloneHandler handler);
5975bb6a25fSPoul-Henning Kamp 
5985bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
5995bb6a25fSPoul-Henning Kamp XML_SetExternalEntityRefHandler(XML_Parser parser,
6005bb6a25fSPoul-Henning Kamp                                 XML_ExternalEntityRefHandler handler);
6015bb6a25fSPoul-Henning Kamp 
6025bb6a25fSPoul-Henning Kamp /* If a non-NULL value for arg is specified here, then it will be
6035bb6a25fSPoul-Henning Kamp    passed as the first argument to the external entity ref handler
6045bb6a25fSPoul-Henning Kamp    instead of the parser object.
6055bb6a25fSPoul-Henning Kamp */
6065bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6075bb6a25fSPoul-Henning Kamp XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
6085bb6a25fSPoul-Henning Kamp 
6095bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6105bb6a25fSPoul-Henning Kamp XML_SetSkippedEntityHandler(XML_Parser parser,
6115bb6a25fSPoul-Henning Kamp                             XML_SkippedEntityHandler handler);
6125bb6a25fSPoul-Henning Kamp 
6135bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6145bb6a25fSPoul-Henning Kamp XML_SetUnknownEncodingHandler(XML_Parser parser,
6155bb6a25fSPoul-Henning Kamp                               XML_UnknownEncodingHandler handler,
6165bb6a25fSPoul-Henning Kamp                               void *encodingHandlerData);
6175bb6a25fSPoul-Henning Kamp 
6185bb6a25fSPoul-Henning Kamp /* This can be called within a handler for a start element, end
6195bb6a25fSPoul-Henning Kamp    element, processing instruction or character data.  It causes the
6205bb6a25fSPoul-Henning Kamp    corresponding markup to be passed to the default handler.
6215bb6a25fSPoul-Henning Kamp */
6225bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6235bb6a25fSPoul-Henning Kamp XML_DefaultCurrent(XML_Parser parser);
6245bb6a25fSPoul-Henning Kamp 
6255bb6a25fSPoul-Henning Kamp /* If do_nst is non-zero, and namespace processing is in effect, and
6265bb6a25fSPoul-Henning Kamp    a name has a prefix (i.e. an explicit namespace qualifier) then
6275bb6a25fSPoul-Henning Kamp    that name is returned as a triplet in a single string separated by
6285bb6a25fSPoul-Henning Kamp    the separator character specified when the parser was created: URI
6295bb6a25fSPoul-Henning Kamp    + sep + local_name + sep + prefix.
6305bb6a25fSPoul-Henning Kamp 
6315bb6a25fSPoul-Henning Kamp    If do_nst is zero, then namespace information is returned in the
6325bb6a25fSPoul-Henning Kamp    default manner (URI + sep + local_name) whether or not the name
6335bb6a25fSPoul-Henning Kamp    has a prefix.
6345bb6a25fSPoul-Henning Kamp 
6355bb6a25fSPoul-Henning Kamp    Note: Calling XML_SetReturnNSTriplet after XML_Parse or
6365bb6a25fSPoul-Henning Kamp      XML_ParseBuffer has no effect.
6375bb6a25fSPoul-Henning Kamp */
6385bb6a25fSPoul-Henning Kamp 
6395bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6405bb6a25fSPoul-Henning Kamp XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
6415bb6a25fSPoul-Henning Kamp 
6425bb6a25fSPoul-Henning Kamp /* This value is passed as the userData argument to callbacks. */
6435bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6445bb6a25fSPoul-Henning Kamp XML_SetUserData(XML_Parser parser, void *userData);
6455bb6a25fSPoul-Henning Kamp 
6465bb6a25fSPoul-Henning Kamp /* Returns the last value set by XML_SetUserData or NULL. */
6475bb6a25fSPoul-Henning Kamp #define XML_GetUserData(parser) (*(void **)(parser))
6485bb6a25fSPoul-Henning Kamp 
6495bb6a25fSPoul-Henning Kamp /* This is equivalent to supplying an encoding argument to
6505bb6a25fSPoul-Henning Kamp    XML_ParserCreate. On success XML_SetEncoding returns non-zero,
6515bb6a25fSPoul-Henning Kamp    zero otherwise.
6525bb6a25fSPoul-Henning Kamp    Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer
6535bb6a25fSPoul-Henning Kamp      has no effect and returns zero.
6545bb6a25fSPoul-Henning Kamp */
6555bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
6565bb6a25fSPoul-Henning Kamp XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
6575bb6a25fSPoul-Henning Kamp 
6585bb6a25fSPoul-Henning Kamp /* If this function is called, then the parser will be passed as the
6595bb6a25fSPoul-Henning Kamp    first argument to callbacks instead of userData.  The userData will
6605bb6a25fSPoul-Henning Kamp    still be accessible using XML_GetUserData.
6615bb6a25fSPoul-Henning Kamp */
6625bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
6635bb6a25fSPoul-Henning Kamp XML_UseParserAsHandlerArg(XML_Parser parser);
6645bb6a25fSPoul-Henning Kamp 
6655bb6a25fSPoul-Henning Kamp /* If useDTD == XML_TRUE is passed to this function, then the parser
6665bb6a25fSPoul-Henning Kamp    will assume that there is an external subset, even if none is
6675bb6a25fSPoul-Henning Kamp    specified in the document. In such a case the parser will call the
6685bb6a25fSPoul-Henning Kamp    externalEntityRefHandler with a value of NULL for the systemId
6695bb6a25fSPoul-Henning Kamp    argument (the publicId and context arguments will be NULL as well).
6705bb6a25fSPoul-Henning Kamp    Note: If this function is called, then this must be done before
6715bb6a25fSPoul-Henning Kamp      the first call to XML_Parse or XML_ParseBuffer, since it will
6725bb6a25fSPoul-Henning Kamp      have no effect after that.  Returns
6735bb6a25fSPoul-Henning Kamp      XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.
6745bb6a25fSPoul-Henning Kamp    Note: If the document does not have a DOCTYPE declaration at all,
6755bb6a25fSPoul-Henning Kamp      then startDoctypeDeclHandler and endDoctypeDeclHandler will not
6765bb6a25fSPoul-Henning Kamp      be called, despite an external subset being parsed.
6775bb6a25fSPoul-Henning Kamp    Note: If XML_DTD is not defined when Expat is compiled, returns
6785bb6a25fSPoul-Henning Kamp      XML_ERROR_FEATURE_REQUIRES_XML_DTD.
6795bb6a25fSPoul-Henning Kamp */
6805bb6a25fSPoul-Henning Kamp XMLPARSEAPI(enum XML_Error)
6815bb6a25fSPoul-Henning Kamp XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
6825bb6a25fSPoul-Henning Kamp 
6835bb6a25fSPoul-Henning Kamp 
6845bb6a25fSPoul-Henning Kamp /* Sets the base to be used for resolving relative URIs in system
6855bb6a25fSPoul-Henning Kamp    identifiers in declarations.  Resolving relative identifiers is
6865bb6a25fSPoul-Henning Kamp    left to the application: this value will be passed through as the
6875bb6a25fSPoul-Henning Kamp    base argument to the XML_ExternalEntityRefHandler,
6885bb6a25fSPoul-Henning Kamp    XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base
6895bb6a25fSPoul-Henning Kamp    argument will be copied.  Returns zero if out of memory, non-zero
6905bb6a25fSPoul-Henning Kamp    otherwise.
6915bb6a25fSPoul-Henning Kamp */
6925bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
6935bb6a25fSPoul-Henning Kamp XML_SetBase(XML_Parser parser, const XML_Char *base);
6945bb6a25fSPoul-Henning Kamp 
6955bb6a25fSPoul-Henning Kamp XMLPARSEAPI(const XML_Char *)
6965bb6a25fSPoul-Henning Kamp XML_GetBase(XML_Parser parser);
6975bb6a25fSPoul-Henning Kamp 
6985bb6a25fSPoul-Henning Kamp /* Returns the number of the attribute/value pairs passed in last call
6995bb6a25fSPoul-Henning Kamp    to the XML_StartElementHandler that were specified in the start-tag
7005bb6a25fSPoul-Henning Kamp    rather than defaulted. Each attribute/value pair counts as 2; thus
7015bb6a25fSPoul-Henning Kamp    this correspondds to an index into the atts array passed to the
7025bb6a25fSPoul-Henning Kamp    XML_StartElementHandler.
7035bb6a25fSPoul-Henning Kamp */
7045bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
7055bb6a25fSPoul-Henning Kamp XML_GetSpecifiedAttributeCount(XML_Parser parser);
7065bb6a25fSPoul-Henning Kamp 
7075bb6a25fSPoul-Henning Kamp /* Returns the index of the ID attribute passed in the last call to
7085bb6a25fSPoul-Henning Kamp    XML_StartElementHandler, or -1 if there is no ID attribute.  Each
7095bb6a25fSPoul-Henning Kamp    attribute/value pair counts as 2; thus this correspondds to an
7105bb6a25fSPoul-Henning Kamp    index into the atts array passed to the XML_StartElementHandler.
7115bb6a25fSPoul-Henning Kamp */
7125bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
7135bb6a25fSPoul-Henning Kamp XML_GetIdAttributeIndex(XML_Parser parser);
7145bb6a25fSPoul-Henning Kamp 
7155bb6a25fSPoul-Henning Kamp /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
7165bb6a25fSPoul-Henning Kamp    detected.  The last call to XML_Parse must have isFinal true; len
7175bb6a25fSPoul-Henning Kamp    may be zero for this call (or any other).
7185bb6a25fSPoul-Henning Kamp 
7195bb6a25fSPoul-Henning Kamp    The XML_Status enum gives the possible return values for the
7205bb6a25fSPoul-Henning Kamp    XML_Parse and XML_ParseBuffer functions.  Though the return values
7215bb6a25fSPoul-Henning Kamp    for these functions has always been described as a Boolean value,
7225bb6a25fSPoul-Henning Kamp    the implementation, at least for the 1.95.x series, has always
7235bb6a25fSPoul-Henning Kamp    returned exactly one of these values.  The preprocessor #defines
7245bb6a25fSPoul-Henning Kamp    are included so this stanza can be added to code that still needs
7255bb6a25fSPoul-Henning Kamp    to support older versions of Expat 1.95.x:
7265bb6a25fSPoul-Henning Kamp 
7275bb6a25fSPoul-Henning Kamp    #ifndef XML_STATUS_OK
7285bb6a25fSPoul-Henning Kamp    #define XML_STATUS_OK    1
7295bb6a25fSPoul-Henning Kamp    #define XML_STATUS_ERROR 0
7305bb6a25fSPoul-Henning Kamp    #endif
7315bb6a25fSPoul-Henning Kamp 
7325bb6a25fSPoul-Henning Kamp    Otherwise, the #define hackery is quite ugly and would have been dropped.
7335bb6a25fSPoul-Henning Kamp */
7345bb6a25fSPoul-Henning Kamp enum XML_Status {
7355bb6a25fSPoul-Henning Kamp   XML_STATUS_ERROR = 0,
7365bb6a25fSPoul-Henning Kamp #define XML_STATUS_ERROR XML_STATUS_ERROR
7375bb6a25fSPoul-Henning Kamp   XML_STATUS_OK = 1
7385bb6a25fSPoul-Henning Kamp #define XML_STATUS_OK XML_STATUS_OK
7395bb6a25fSPoul-Henning Kamp };
7405bb6a25fSPoul-Henning Kamp 
7415bb6a25fSPoul-Henning Kamp XMLPARSEAPI(enum XML_Status)
7425bb6a25fSPoul-Henning Kamp XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
7435bb6a25fSPoul-Henning Kamp 
7445bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void *)
7455bb6a25fSPoul-Henning Kamp XML_GetBuffer(XML_Parser parser, int len);
7465bb6a25fSPoul-Henning Kamp 
7475bb6a25fSPoul-Henning Kamp XMLPARSEAPI(enum XML_Status)
7485bb6a25fSPoul-Henning Kamp XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
7495bb6a25fSPoul-Henning Kamp 
7505bb6a25fSPoul-Henning Kamp /* Creates an XML_Parser object that can parse an external general
7515bb6a25fSPoul-Henning Kamp    entity; context is a '\0'-terminated string specifying the parse
7525bb6a25fSPoul-Henning Kamp    context; encoding is a '\0'-terminated string giving the name of
7535bb6a25fSPoul-Henning Kamp    the externally specified encoding, or NULL if there is no
7545bb6a25fSPoul-Henning Kamp    externally specified encoding.  The context string consists of a
7555bb6a25fSPoul-Henning Kamp    sequence of tokens separated by formfeeds (\f); a token consisting
7565bb6a25fSPoul-Henning Kamp    of a name specifies that the general entity of the name is open; a
7575bb6a25fSPoul-Henning Kamp    token of the form prefix=uri specifies the namespace for a
7585bb6a25fSPoul-Henning Kamp    particular prefix; a token of the form =uri specifies the default
7595bb6a25fSPoul-Henning Kamp    namespace.  This can be called at any point after the first call to
7605bb6a25fSPoul-Henning Kamp    an ExternalEntityRefHandler so longer as the parser has not yet
7615bb6a25fSPoul-Henning Kamp    been freed.  The new parser is completely independent and may
7625bb6a25fSPoul-Henning Kamp    safely be used in a separate thread.  The handlers and userData are
7635bb6a25fSPoul-Henning Kamp    initialized from the parser argument.  Returns 0 if out of memory.
7645bb6a25fSPoul-Henning Kamp    Otherwise returns a new XML_Parser object.
7655bb6a25fSPoul-Henning Kamp */
7665bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Parser)
7675bb6a25fSPoul-Henning Kamp XML_ExternalEntityParserCreate(XML_Parser parser,
7685bb6a25fSPoul-Henning Kamp                                const XML_Char *context,
7695bb6a25fSPoul-Henning Kamp                                const XML_Char *encoding);
7705bb6a25fSPoul-Henning Kamp 
7715bb6a25fSPoul-Henning Kamp enum XML_ParamEntityParsing {
7725bb6a25fSPoul-Henning Kamp   XML_PARAM_ENTITY_PARSING_NEVER,
7735bb6a25fSPoul-Henning Kamp   XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
7745bb6a25fSPoul-Henning Kamp   XML_PARAM_ENTITY_PARSING_ALWAYS
7755bb6a25fSPoul-Henning Kamp };
7765bb6a25fSPoul-Henning Kamp 
7775bb6a25fSPoul-Henning Kamp /* Controls parsing of parameter entities (including the external DTD
7785bb6a25fSPoul-Henning Kamp    subset). If parsing of parameter entities is enabled, then
7795bb6a25fSPoul-Henning Kamp    references to external parameter entities (including the external
7805bb6a25fSPoul-Henning Kamp    DTD subset) will be passed to the handler set with
7815bb6a25fSPoul-Henning Kamp    XML_SetExternalEntityRefHandler.  The context passed will be 0.
7825bb6a25fSPoul-Henning Kamp 
7835bb6a25fSPoul-Henning Kamp    Unlike external general entities, external parameter entities can
7845bb6a25fSPoul-Henning Kamp    only be parsed synchronously.  If the external parameter entity is
7855bb6a25fSPoul-Henning Kamp    to be parsed, it must be parsed during the call to the external
7865bb6a25fSPoul-Henning Kamp    entity ref handler: the complete sequence of
7875bb6a25fSPoul-Henning Kamp    XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
7885bb6a25fSPoul-Henning Kamp    XML_ParserFree calls must be made during this call.  After
7895bb6a25fSPoul-Henning Kamp    XML_ExternalEntityParserCreate has been called to create the parser
7905bb6a25fSPoul-Henning Kamp    for the external parameter entity (context must be 0 for this
7915bb6a25fSPoul-Henning Kamp    call), it is illegal to make any calls on the old parser until
7925bb6a25fSPoul-Henning Kamp    XML_ParserFree has been called on the newly created parser.
7935bb6a25fSPoul-Henning Kamp    If the library has been compiled without support for parameter
7945bb6a25fSPoul-Henning Kamp    entity parsing (ie without XML_DTD being defined), then
7955bb6a25fSPoul-Henning Kamp    XML_SetParamEntityParsing will return 0 if parsing of parameter
7965bb6a25fSPoul-Henning Kamp    entities is requested; otherwise it will return non-zero.
7975bb6a25fSPoul-Henning Kamp    Note: If XML_SetParamEntityParsing is called after XML_Parse or
7985bb6a25fSPoul-Henning Kamp       XML_ParseBuffer, then it has no effect and will always return 0.
7995bb6a25fSPoul-Henning Kamp */
8005bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
8015bb6a25fSPoul-Henning Kamp XML_SetParamEntityParsing(XML_Parser parser,
8025bb6a25fSPoul-Henning Kamp                           enum XML_ParamEntityParsing parsing);
8035bb6a25fSPoul-Henning Kamp 
8045bb6a25fSPoul-Henning Kamp /* If XML_Parse or XML_ParseBuffer have returned 0, then
8055bb6a25fSPoul-Henning Kamp    XML_GetErrorCode returns information about the error.
8065bb6a25fSPoul-Henning Kamp */
8075bb6a25fSPoul-Henning Kamp XMLPARSEAPI(enum XML_Error)
8085bb6a25fSPoul-Henning Kamp XML_GetErrorCode(XML_Parser parser);
8095bb6a25fSPoul-Henning Kamp 
8105bb6a25fSPoul-Henning Kamp /* These functions return information about the current parse
8115bb6a25fSPoul-Henning Kamp    location.  They may be called when XML_Parse or XML_ParseBuffer
8125bb6a25fSPoul-Henning Kamp    return 0; in this case the location is the location of the
8135bb6a25fSPoul-Henning Kamp    character at which the error was detected.
8145bb6a25fSPoul-Henning Kamp 
8155bb6a25fSPoul-Henning Kamp    They may also be called from any other callback called to report
8165bb6a25fSPoul-Henning Kamp    some parse event; in this the location is the location of the first
8175bb6a25fSPoul-Henning Kamp    of the sequence of characters that generated the event.
8185bb6a25fSPoul-Henning Kamp */
8195bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
8205bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
8215bb6a25fSPoul-Henning Kamp XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser);
8225bb6a25fSPoul-Henning Kamp 
8235bb6a25fSPoul-Henning Kamp /* Return the number of bytes in the current event.
8245bb6a25fSPoul-Henning Kamp    Returns 0 if the event is in an internal entity.
8255bb6a25fSPoul-Henning Kamp */
8265bb6a25fSPoul-Henning Kamp XMLPARSEAPI(int)
8275bb6a25fSPoul-Henning Kamp XML_GetCurrentByteCount(XML_Parser parser);
8285bb6a25fSPoul-Henning Kamp 
8295bb6a25fSPoul-Henning Kamp /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
8305bb6a25fSPoul-Henning Kamp    the integer pointed to by offset to the offset within this buffer
8315bb6a25fSPoul-Henning Kamp    of the current parse position, and sets the integer pointed to by size
8325bb6a25fSPoul-Henning Kamp    to the size of this buffer (the number of input bytes). Otherwise
8335bb6a25fSPoul-Henning Kamp    returns a NULL pointer. Also returns a NULL pointer if a parse isn't
8345bb6a25fSPoul-Henning Kamp    active.
8355bb6a25fSPoul-Henning Kamp 
8365bb6a25fSPoul-Henning Kamp    NOTE: The character pointer returned should not be used outside
8375bb6a25fSPoul-Henning Kamp    the handler that makes the call.
8385bb6a25fSPoul-Henning Kamp */
8395bb6a25fSPoul-Henning Kamp XMLPARSEAPI(const char *)
8405bb6a25fSPoul-Henning Kamp XML_GetInputContext(XML_Parser parser,
8415bb6a25fSPoul-Henning Kamp                     int *offset,
8425bb6a25fSPoul-Henning Kamp                     int *size);
8435bb6a25fSPoul-Henning Kamp 
8445bb6a25fSPoul-Henning Kamp /* For backwards compatibility with previous versions. */
8455bb6a25fSPoul-Henning Kamp #define XML_GetErrorLineNumber   XML_GetCurrentLineNumber
8465bb6a25fSPoul-Henning Kamp #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
8475bb6a25fSPoul-Henning Kamp #define XML_GetErrorByteIndex    XML_GetCurrentByteIndex
8485bb6a25fSPoul-Henning Kamp 
8495bb6a25fSPoul-Henning Kamp /* Frees memory used by the parser. */
8505bb6a25fSPoul-Henning Kamp XMLPARSEAPI(void)
8515bb6a25fSPoul-Henning Kamp XML_ParserFree(XML_Parser parser);
8525bb6a25fSPoul-Henning Kamp 
8535bb6a25fSPoul-Henning Kamp /* Returns a string describing the error. */
8545bb6a25fSPoul-Henning Kamp XMLPARSEAPI(const XML_LChar *)
8555bb6a25fSPoul-Henning Kamp XML_ErrorString(enum XML_Error code);
8565bb6a25fSPoul-Henning Kamp 
8575bb6a25fSPoul-Henning Kamp /* Return a string containing the version number of this expat */
8585bb6a25fSPoul-Henning Kamp XMLPARSEAPI(const XML_LChar *)
8595bb6a25fSPoul-Henning Kamp XML_ExpatVersion(void);
8605bb6a25fSPoul-Henning Kamp 
8615bb6a25fSPoul-Henning Kamp typedef struct {
8625bb6a25fSPoul-Henning Kamp   int major;
8635bb6a25fSPoul-Henning Kamp   int minor;
8645bb6a25fSPoul-Henning Kamp   int micro;
8655bb6a25fSPoul-Henning Kamp } XML_Expat_Version;
8665bb6a25fSPoul-Henning Kamp 
8675bb6a25fSPoul-Henning Kamp /* Return an XML_Expat_Version structure containing numeric version
8685bb6a25fSPoul-Henning Kamp    number information for this version of expat.
8695bb6a25fSPoul-Henning Kamp */
8705bb6a25fSPoul-Henning Kamp XMLPARSEAPI(XML_Expat_Version)
8715bb6a25fSPoul-Henning Kamp XML_ExpatVersionInfo(void);
8725bb6a25fSPoul-Henning Kamp 
8735bb6a25fSPoul-Henning Kamp /* Added in Expat 1.95.5. */
8745bb6a25fSPoul-Henning Kamp enum XML_FeatureEnum {
8755bb6a25fSPoul-Henning Kamp   XML_FEATURE_END = 0,
8765bb6a25fSPoul-Henning Kamp   XML_FEATURE_UNICODE,
8775bb6a25fSPoul-Henning Kamp   XML_FEATURE_UNICODE_WCHAR_T,
8785bb6a25fSPoul-Henning Kamp   XML_FEATURE_DTD,
8795bb6a25fSPoul-Henning Kamp   XML_FEATURE_CONTEXT_BYTES,
8805bb6a25fSPoul-Henning Kamp   XML_FEATURE_MIN_SIZE,
8815bb6a25fSPoul-Henning Kamp   XML_FEATURE_SIZEOF_XML_CHAR,
8825bb6a25fSPoul-Henning Kamp   XML_FEATURE_SIZEOF_XML_LCHAR
8835bb6a25fSPoul-Henning Kamp   /* Additional features must be added to the end of this enum. */
8845bb6a25fSPoul-Henning Kamp };
8855bb6a25fSPoul-Henning Kamp 
8865bb6a25fSPoul-Henning Kamp typedef struct {
8875bb6a25fSPoul-Henning Kamp   enum XML_FeatureEnum  feature;
8885bb6a25fSPoul-Henning Kamp   XML_LChar            *name;
8895bb6a25fSPoul-Henning Kamp   long int              value;
8905bb6a25fSPoul-Henning Kamp } XML_Feature;
8915bb6a25fSPoul-Henning Kamp 
8925bb6a25fSPoul-Henning Kamp XMLPARSEAPI(const XML_Feature *)
8935bb6a25fSPoul-Henning Kamp XML_GetFeatureList(void);
8945bb6a25fSPoul-Henning Kamp 
8955bb6a25fSPoul-Henning Kamp 
8965bb6a25fSPoul-Henning Kamp /* Expat follows the GNU/Linux convention of odd number minor version for
8975bb6a25fSPoul-Henning Kamp    beta/development releases and even number minor version for stable
8985bb6a25fSPoul-Henning Kamp    releases. Micro is bumped with each release, and set to 0 with each
8995bb6a25fSPoul-Henning Kamp    change to major or minor version.
9005bb6a25fSPoul-Henning Kamp */
9015bb6a25fSPoul-Henning Kamp #define XML_MAJOR_VERSION 1
9025bb6a25fSPoul-Henning Kamp #define XML_MINOR_VERSION 95
9035bb6a25fSPoul-Henning Kamp #define XML_MICRO_VERSION 5
9045bb6a25fSPoul-Henning Kamp 
9055bb6a25fSPoul-Henning Kamp #ifdef __cplusplus
9065bb6a25fSPoul-Henning Kamp }
9075bb6a25fSPoul-Henning Kamp #endif
9085bb6a25fSPoul-Henning Kamp 
9095bb6a25fSPoul-Henning Kamp #endif /* not XmlParse_INCLUDED */
910