| 1 | /* | 
|---|
| 2 | Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd | 
|---|
| 3 | See the file COPYING for copying permission. | 
|---|
| 4 | */ | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef XmlParse_INCLUDED | 
|---|
| 7 | #define XmlParse_INCLUDED 1 | 
|---|
| 8 |  | 
|---|
| 9 | #include <stdlib.h> | 
|---|
| 10 |  | 
|---|
| 11 | #include "expat\expat_setup.h" | 
|---|
| 12 | // V0.9.9 (2001-02-10) [umoeller] | 
|---|
| 13 | // to save the app from having to include this as well | 
|---|
| 14 |  | 
|---|
| 15 | /* #ifndef XMLPARSEAPI | 
|---|
| 16 | #ifdef EXPATENTRY | 
|---|
| 17 | // #define XMLPARSEAPI(type) type EXPATENTRY | 
|---|
| 18 | #define XMLPARSEAPI(type) | 
|---|
| 19 | // V0.9.14 (2001-08-09) [umoeller] | 
|---|
| 20 | #else | 
|---|
| 21 | #define XMLPARSEAPI(type) type | 
|---|
| 22 | #endif | 
|---|
| 23 | #endif */ | 
|---|
| 24 |  | 
|---|
| 25 | #ifndef XMLPARSEAPI | 
|---|
| 26 | #  ifdef __declspec | 
|---|
| 27 | #    define XMLPARSEAPI __declspec(dllimport) | 
|---|
| 28 | #  else | 
|---|
| 29 | #    define XMLPARSEAPI /* nothing */ | 
|---|
| 30 | #  endif | 
|---|
| 31 | #endif  /* not defined XMLPARSEAPI */ | 
|---|
| 32 |  | 
|---|
| 33 | #ifdef __cplusplus | 
|---|
| 34 | extern "C" { | 
|---|
| 35 | #endif | 
|---|
| 36 |  | 
|---|
| 37 | typedef void *XML_Parser; | 
|---|
| 38 |  | 
|---|
| 39 | /* Information is UTF-8 encoded. */ | 
|---|
| 40 | typedef char XML_Char; | 
|---|
| 41 | typedef char XML_LChar; | 
|---|
| 42 |  | 
|---|
| 43 | enum XML_Content_Type | 
|---|
| 44 | { | 
|---|
| 45 | XML_CTYPE_EMPTY = 1, | 
|---|
| 46 | XML_CTYPE_ANY, | 
|---|
| 47 | XML_CTYPE_MIXED, | 
|---|
| 48 | XML_CTYPE_NAME, | 
|---|
| 49 | XML_CTYPE_CHOICE, | 
|---|
| 50 | XML_CTYPE_SEQ | 
|---|
| 51 | }; | 
|---|
| 52 |  | 
|---|
| 53 | enum XML_Content_Quant | 
|---|
| 54 | { | 
|---|
| 55 | XML_CQUANT_NONE, | 
|---|
| 56 | XML_CQUANT_OPT, | 
|---|
| 57 | XML_CQUANT_REP, | 
|---|
| 58 | XML_CQUANT_PLUS | 
|---|
| 59 | }; | 
|---|
| 60 |  | 
|---|
| 61 | /* | 
|---|
| 62 | *@@ XMLCONTENT: | 
|---|
| 63 | *      structure passed with the @expat "element declaration handler" | 
|---|
| 64 | *      (see XML_SetElementDeclHandler). | 
|---|
| 65 | * | 
|---|
| 66 | *      The model argument is the root of a tree of XMLCONTENT | 
|---|
| 67 | *      nodes. If type equals XML_CTYPE_EMPTY or XML_CTYPE_ANY, | 
|---|
| 68 | *      then quant will be XML_CQUANT_NONE, and the other fields | 
|---|
| 69 | *      will be zero or NULL. | 
|---|
| 70 | * | 
|---|
| 71 | *      If type is XML_CTYPE_MIXED: | 
|---|
| 72 | * | 
|---|
| 73 | *      --  "quant" will be XML_CQUANT_NONE or XML_CQUANT_REP. | 
|---|
| 74 | * | 
|---|
| 75 | *      --  "numchildren" will contain the number of elements that | 
|---|
| 76 | *          are allowed to be mixed in. | 
|---|
| 77 | * | 
|---|
| 78 | *      --  "children" points to a sub-array of XMLCONTENT structures | 
|---|
| 79 | *          that will all have type XML_CTYPE_NAME with no quantification. | 
|---|
| 80 | * | 
|---|
| 81 | *      Only the root node can be type XML_CTYPE_EMPTY, XML_CTYPE_ANY, | 
|---|
| 82 | *      or XML_CTYPE_MIXED. | 
|---|
| 83 | * | 
|---|
| 84 | *      For type XML_CTYPE_NAME, the name field points to the | 
|---|
| 85 | *      name and the numchildren and children fields will be | 
|---|
| 86 | *      zero and NULL. The quant field will indicate any | 
|---|
| 87 | *      quantifiers placed on the name. | 
|---|
| 88 | * | 
|---|
| 89 | *      Types XML_CTYPE_CHOICE and XML_CTYPE_SEQ indicate a | 
|---|
| 90 | *      choice or sequence respectively. The numchildren field | 
|---|
| 91 | *      indicates how many nodes in the choice or sequence and | 
|---|
| 92 | *      children points to the nodes. | 
|---|
| 93 | * | 
|---|
| 94 | *@@added V0.9.9 (2001-02-14) [umoeller] | 
|---|
| 95 | */ | 
|---|
| 96 |  | 
|---|
| 97 | typedef struct _XMLCONTENT | 
|---|
| 98 | { | 
|---|
| 99 | enum XML_Content_Type       type; | 
|---|
| 100 | // one of: | 
|---|
| 101 | // -- XML_CTYPE_EMPTY   --> quant will be XML_CQUANT_NONE, rest is NULL | 
|---|
| 102 | // -- XML_CTYPE_ANY,    --> quant will be XML_CQUANT_NONE, rest is NULL | 
|---|
| 103 | // -- XML_CTYPE_MIXED,  --> (#PCDATA) gives us this | 
|---|
| 104 | // -- XML_CTYPE_CHOICE, --> choice ("|" list) | 
|---|
| 105 | // -- XML_CTYPE_SEQ     --> sequence (comma list) | 
|---|
| 106 |  | 
|---|
| 107 | // -- XML_CTYPE_NAME: used for sub-content if content has CML_CTYPE_MIXED; | 
|---|
| 108 | //                    only "name" is valid for sub-content | 
|---|
| 109 |  | 
|---|
| 110 | enum XML_Content_Quant      quant; | 
|---|
| 111 | // one of: | 
|---|
| 112 | // -- XML_CQUANT_NONE   --> all fields below are NULL | 
|---|
| 113 | // -- XML_CQUANT_OPT,   question mark | 
|---|
| 114 | // -- XML_CQUANT_REP,   asterisk | 
|---|
| 115 | // -- XML_CQUANT_PLUS   plus sign | 
|---|
| 116 |  | 
|---|
| 117 | XML_Char                    *name; | 
|---|
| 118 |  | 
|---|
| 119 | unsigned int                numchildren; | 
|---|
| 120 |  | 
|---|
| 121 | struct _XMLCONTENT          *children; | 
|---|
| 122 | } XMLCONTENT, *PXMLCONTENT; | 
|---|
| 123 |  | 
|---|
| 124 |  | 
|---|
| 125 | /* This is called for an element declaration. See above for | 
|---|
| 126 | description of the model argument. It's the caller's responsibility | 
|---|
| 127 | to free model when finished with it. | 
|---|
| 128 | */ | 
|---|
| 129 |  | 
|---|
| 130 | typedef void (* EXPATENTRY XML_ElementDeclHandler) (void *userData, | 
|---|
| 131 | const XML_Char *name, | 
|---|
| 132 | XMLCONTENT *model); | 
|---|
| 133 |  | 
|---|
| 134 | void EXPATENTRY XML_SetElementDeclHandler(XML_Parser parser, | 
|---|
| 135 | XML_ElementDeclHandler eldecl); | 
|---|
| 136 |  | 
|---|
| 137 | /* | 
|---|
| 138 | The Attlist declaration handler is called for *each* attribute. So | 
|---|
| 139 | a single Attlist declaration with multiple attributes declared will | 
|---|
| 140 | generate multiple calls to this handler. The "default" parameter | 
|---|
| 141 | may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword. | 
|---|
| 142 | The "isrequired" parameter will be true and the default value will | 
|---|
| 143 | be NULL in the case of "#REQUIRED". If "isrequired" is true and | 
|---|
| 144 | default is non-NULL, then this is a "#FIXED" default. | 
|---|
| 145 | */ | 
|---|
| 146 |  | 
|---|
| 147 | typedef void (* EXPATENTRY XML_AttlistDeclHandler) (void           *userData, | 
|---|
| 148 | const XML_Char *elname, | 
|---|
| 149 | const XML_Char *attname, | 
|---|
| 150 | const XML_Char *att_type, | 
|---|
| 151 | const XML_Char *dflt, | 
|---|
| 152 | int     isrequired); | 
|---|
| 153 |  | 
|---|
| 154 | void EXPATENTRY | 
|---|
| 155 | XML_SetAttlistDeclHandler(XML_Parser parser, | 
|---|
| 156 | XML_AttlistDeclHandler attdecl); | 
|---|
| 157 |  | 
|---|
| 158 |  | 
|---|
| 159 | /* The XML declaration handler is called for *both* XML declarations and | 
|---|
| 160 | text declarations. The way to distinguish is that the version parameter | 
|---|
| 161 | will be null for text declarations. The encoding parameter may be null | 
|---|
| 162 | for XML declarations. The standalone parameter will be -1, 0, or 1 | 
|---|
| 163 | indicating respectively that there was no standalone parameter in | 
|---|
| 164 | the declaration, that it was given as no, or that it was given as yes. | 
|---|
| 165 | */ | 
|---|
| 166 |  | 
|---|
| 167 | typedef void (* EXPATENTRY XML_XmlDeclHandler) (void        *userData, | 
|---|
| 168 | const XML_Char  *version, | 
|---|
| 169 | const XML_Char  *encoding, | 
|---|
| 170 | int          standalone); | 
|---|
| 171 |  | 
|---|
| 172 | void EXPATENTRY | 
|---|
| 173 | XML_SetXmlDeclHandler(XML_Parser parser, | 
|---|
| 174 | XML_XmlDeclHandler xmldecl); | 
|---|
| 175 |  | 
|---|
| 176 |  | 
|---|
| 177 | typedef struct { | 
|---|
| 178 | void *(*malloc_fcn)(size_t size); | 
|---|
| 179 | void *(*realloc_fcn)(void *ptr, size_t size); | 
|---|
| 180 | void (*free_fcn)(void *ptr); | 
|---|
| 181 | } XML_Memory_Handling_Suite; | 
|---|
| 182 |  | 
|---|
| 183 | /* Constructs a new parser; encoding is the encoding specified by the | 
|---|
| 184 | external protocol or null if there is none specified. */ | 
|---|
| 185 |  | 
|---|
| 186 | XML_Parser EXPATENTRY | 
|---|
| 187 | XML_ParserCreate(const XML_Char *encoding); | 
|---|
| 188 |  | 
|---|
| 189 | /* Constructs a new parser and namespace processor.  Element type | 
|---|
| 190 | names and attribute names that belong to a namespace will be expanded; | 
|---|
| 191 | unprefixed attribute names are never expanded; unprefixed element type | 
|---|
| 192 | names are expanded only if there is a default namespace. The expanded | 
|---|
| 193 | name is the concatenation of the namespace URI, the namespace | 
|---|
| 194 | separator character, and the local part of the name.  If the namespace | 
|---|
| 195 | separator is '\0' then the namespace URI and the local part will be | 
|---|
| 196 | concatenated without any separator.  When a namespace is not declared, | 
|---|
| 197 | the name and prefix will be passed through without expansion. */ | 
|---|
| 198 |  | 
|---|
| 199 | XML_Parser EXPATENTRY | 
|---|
| 200 | XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); | 
|---|
| 201 |  | 
|---|
| 202 |  | 
|---|
| 203 | /* Constructs a new parser using the memory management suit referred to | 
|---|
| 204 | by memsuite. If memsuite is NULL, then use the standard library memory | 
|---|
| 205 | suite. If namespaceSeparator is non-NULL it creates a parser with | 
|---|
| 206 | namespace processing as described above. The character pointed at | 
|---|
| 207 | will serve as the namespace separator. | 
|---|
| 208 |  | 
|---|
| 209 | All further memory operations used for the created parser will come from | 
|---|
| 210 | the given suite. | 
|---|
| 211 | */ | 
|---|
| 212 |  | 
|---|
| 213 | XML_Parser EXPATENTRY | 
|---|
| 214 | XML_ParserCreate_MM(const XML_Char *encoding, | 
|---|
| 215 | const XML_Memory_Handling_Suite *memsuite, | 
|---|
| 216 | const XML_Char *namespaceSeparator); | 
|---|
| 217 |  | 
|---|
| 218 | /* atts is array of name/value pairs, terminated by 0; | 
|---|
| 219 | names and values are 0 terminated. */ | 
|---|
| 220 |  | 
|---|
| 221 | typedef void (* EXPATENTRY XML_StartElementHandler)(void *userData, | 
|---|
| 222 | const XML_Char *name, | 
|---|
| 223 | const XML_Char **atts); | 
|---|
| 224 |  | 
|---|
| 225 | typedef void (* EXPATENTRY XML_EndElementHandler)(void *userData, | 
|---|
| 226 | const XML_Char *name); | 
|---|
| 227 |  | 
|---|
| 228 |  | 
|---|
| 229 | /* s is not 0 terminated. */ | 
|---|
| 230 | typedef void (* EXPATENTRY XML_CharacterDataHandler)(void *userData, | 
|---|
| 231 | const XML_Char *s, | 
|---|
| 232 | int len); | 
|---|
| 233 |  | 
|---|
| 234 | /* target and data are 0 terminated */ | 
|---|
| 235 | typedef void (* EXPATENTRY XML_ProcessingInstructionHandler)(void *userData, | 
|---|
| 236 | const XML_Char *target, | 
|---|
| 237 | const XML_Char *data); | 
|---|
| 238 |  | 
|---|
| 239 | /* data is 0 terminated */ | 
|---|
| 240 | typedef void (* EXPATENTRY XML_CommentHandler)(void *userData, const XML_Char *data); | 
|---|
| 241 |  | 
|---|
| 242 | typedef void (* EXPATENTRY XML_StartCdataSectionHandler)(void *userData); | 
|---|
| 243 | typedef void (* EXPATENTRY XML_EndCdataSectionHandler)(void *userData); | 
|---|
| 244 |  | 
|---|
| 245 | /* This is called for any characters in the XML document for | 
|---|
| 246 | which there is no applicable handler.  This includes both | 
|---|
| 247 | characters that are part of markup which is of a kind that is | 
|---|
| 248 | not reported (comments, markup declarations), or characters | 
|---|
| 249 | that are part of a construct which could be reported but | 
|---|
| 250 | for which no handler has been supplied. The characters are passed | 
|---|
| 251 | exactly as they were in the XML document except that | 
|---|
| 252 | they will be encoded in UTF-8.  Line boundaries are not normalized. | 
|---|
| 253 | Note that a byte order mark character is not passed to the default handler. | 
|---|
| 254 | There are no guarantees about how characters are divided between calls | 
|---|
| 255 | to the default handler: for example, a comment might be split between | 
|---|
| 256 | multiple calls. */ | 
|---|
| 257 |  | 
|---|
| 258 | typedef void (* EXPATENTRY XML_DefaultHandler)(void *userData, | 
|---|
| 259 | const XML_Char *s, | 
|---|
| 260 | int len); | 
|---|
| 261 |  | 
|---|
| 262 | /* This is called for the start of the DOCTYPE declaration, before | 
|---|
| 263 | any DTD or internal subset is parsed. */ | 
|---|
| 264 |  | 
|---|
| 265 | typedef void (* EXPATENTRY XML_StartDoctypeDeclHandler)(void *userData, | 
|---|
| 266 | const XML_Char *doctypeName, | 
|---|
| 267 | const XML_Char *sysid, | 
|---|
| 268 | const XML_Char *pubid, | 
|---|
| 269 | int has_internal_subset); | 
|---|
| 270 |  | 
|---|
| 271 | /* This is called for the start of the DOCTYPE declaration when the | 
|---|
| 272 | closing > is encountered, but after processing any external subset. */ | 
|---|
| 273 | typedef void (* EXPATENTRY XML_EndDoctypeDeclHandler)(void *userData); | 
|---|
| 274 |  | 
|---|
| 275 | /* This is called for entity declarations. The is_parameter_entity | 
|---|
| 276 | argument will be non-zero if the entity is a parameter entity, zero | 
|---|
| 277 | otherwise. | 
|---|
| 278 |  | 
|---|
| 279 | For internal entities (<!ENTITY foo "bar">), value will | 
|---|
| 280 | be non-null and systemId, publicID, and notationName will be null. | 
|---|
| 281 | The value string is NOT null terminated; the length is provided in | 
|---|
| 282 | the value_length argument. Since it is legal to have zero-length | 
|---|
| 283 | values, do not use this argument to test for internal entities. | 
|---|
| 284 |  | 
|---|
| 285 | For external entities, value will be null and systemId will be non-null. | 
|---|
| 286 | The publicId argument will be null unless a public identifier was | 
|---|
| 287 | provided. The notationName argument will have a non-null value only | 
|---|
| 288 | for unparsed entity declarations. | 
|---|
| 289 | */ | 
|---|
| 290 |  | 
|---|
| 291 | typedef void (* EXPATENTRY XML_EntityDeclHandler) (void *userData, | 
|---|
| 292 | const XML_Char *entityName, | 
|---|
| 293 | int is_parameter_entity, | 
|---|
| 294 | const XML_Char *value, | 
|---|
| 295 | int value_length, | 
|---|
| 296 | const XML_Char *base, | 
|---|
| 297 | const XML_Char *systemId, | 
|---|
| 298 | const XML_Char *publicId, | 
|---|
| 299 | const XML_Char *notationName); | 
|---|
| 300 |  | 
|---|
| 301 | void EXPATENTRY | 
|---|
| 302 | XML_SetEntityDeclHandler(XML_Parser parser, | 
|---|
| 303 | XML_EntityDeclHandler handler); | 
|---|
| 304 |  | 
|---|
| 305 | /* OBSOLETE -- OBSOLETE -- OBSOLETE | 
|---|
| 306 | This handler has been superceded by the EntityDeclHandler above. | 
|---|
| 307 | It is provided here for backward compatibility. | 
|---|
| 308 | This is called for a declaration of an unparsed (NDATA) | 
|---|
| 309 | entity.  The base argument is whatever was set by XML_SetBase. | 
|---|
| 310 | The entityName, systemId and notationName arguments will never be null. | 
|---|
| 311 | The other arguments may be. */ | 
|---|
| 312 |  | 
|---|
| 313 | typedef void (* EXPATENTRY XML_UnparsedEntityDeclHandler)(void *userData, | 
|---|
| 314 | const XML_Char *entityName, | 
|---|
| 315 | const XML_Char *base, | 
|---|
| 316 | const XML_Char *systemId, | 
|---|
| 317 | const XML_Char *publicId, | 
|---|
| 318 | const XML_Char *notationName); | 
|---|
| 319 |  | 
|---|
| 320 | /* This is called for a declaration of notation. | 
|---|
| 321 | The base argument is whatever was set by XML_SetBase. | 
|---|
| 322 | The notationName will never be null.  The other arguments can be. */ | 
|---|
| 323 |  | 
|---|
| 324 | typedef void (* EXPATENTRY XML_NotationDeclHandler)(void *userData, | 
|---|
| 325 | const XML_Char *notationName, | 
|---|
| 326 | const XML_Char *base, | 
|---|
| 327 | const XML_Char *systemId, | 
|---|
| 328 | const XML_Char *publicId); | 
|---|
| 329 |  | 
|---|
| 330 | /* When namespace processing is enabled, these are called once for | 
|---|
| 331 | each namespace declaration. The call to the start and end element | 
|---|
| 332 | handlers occur between the calls to the start and end namespace | 
|---|
| 333 | declaration handlers. For an xmlns attribute, prefix will be null. | 
|---|
| 334 | For an xmlns="" attribute, uri will be null. */ | 
|---|
| 335 |  | 
|---|
| 336 | typedef void (* EXPATENTRY XML_StartNamespaceDeclHandler)(void *userData, | 
|---|
| 337 | const XML_Char *prefix, | 
|---|
| 338 | const XML_Char *uri); | 
|---|
| 339 |  | 
|---|
| 340 | typedef void (* EXPATENTRY XML_EndNamespaceDeclHandler)(void *userData, | 
|---|
| 341 | const XML_Char *prefix); | 
|---|
| 342 |  | 
|---|
| 343 | /* This is called if the document is not standalone (it has an | 
|---|
| 344 | external subset or a reference to a parameter entity, but does not | 
|---|
| 345 | have standalone="yes"). If this handler returns 0, then processing | 
|---|
| 346 | will not continue, and the parser will return a | 
|---|
| 347 | ERROR_EXPAT_NOT_STANDALONE error. */ | 
|---|
| 348 |  | 
|---|
| 349 | typedef int (* EXPATENTRY XML_NotStandaloneHandler)(void *userData); | 
|---|
| 350 |  | 
|---|
| 351 | /* This is called for a reference to an external parsed general entity. | 
|---|
| 352 | The referenced entity is not automatically parsed. | 
|---|
| 353 | The application can parse it immediately or later using | 
|---|
| 354 | XML_ExternalEntityParserCreate. | 
|---|
| 355 | The parser argument is the parser parsing the entity containing the reference; | 
|---|
| 356 | it can be passed as the parser argument to XML_ExternalEntityParserCreate. | 
|---|
| 357 | The systemId argument is the system identifier as specified in the entity | 
|---|
| 358 | declaration; it will not be null. | 
|---|
| 359 | The base argument is the system identifier that should be used as the base for | 
|---|
| 360 | resolving systemId if systemId was relative; this is set by XML_SetBase; | 
|---|
| 361 | it may be null. | 
|---|
| 362 | The publicId argument is the public identifier as specified in the entity | 
|---|
| 363 | declaration, or null if none was specified; the whitespace in the public | 
|---|
| 364 | identifier will have been normalized as required by the XML spec. | 
|---|
| 365 | The context argument specifies the parsing context in the format | 
|---|
| 366 | expected by the context argument to | 
|---|
| 367 | XML_ExternalEntityParserCreate; context is valid only until the handler | 
|---|
| 368 | returns, so if the referenced entity is to be parsed later, it must be copied. | 
|---|
| 369 | The handler should return 0 if processing should not continue because of | 
|---|
| 370 | a fatal error in the handling of the external entity. | 
|---|
| 371 | In this case the calling parser will return an | 
|---|
| 372 | ERROR_EXPAT_EXTERNAL_ENTITY_HANDLING error. | 
|---|
| 373 | Note that unlike other handlers the first argument is the parser, not | 
|---|
| 374 | userData. */ | 
|---|
| 375 |  | 
|---|
| 376 | typedef int (* EXPATENTRY XML_ExternalEntityRefHandler)(void *userData,     // added V0.9.14 (2001-08-09) [umoeller] | 
|---|
| 377 | XML_Parser parser, | 
|---|
| 378 | const XML_Char *context, | 
|---|
| 379 | const XML_Char *base, | 
|---|
| 380 | const XML_Char *systemId, | 
|---|
| 381 | const XML_Char *publicId); | 
|---|
| 382 |  | 
|---|
| 383 | /* This structure is filled in by the XML_UnknownEncodingHandler | 
|---|
| 384 | to provide information to the parser about encodings that are unknown | 
|---|
| 385 | to the parser. | 
|---|
| 386 | The map[b] member gives information about byte sequences | 
|---|
| 387 | whose first byte is b. | 
|---|
| 388 | If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar | 
|---|
| 389 | value c. | 
|---|
| 390 | If map[b] is -1, then the byte sequence is malformed. | 
|---|
| 391 | If map[b] is -n, where n >= 2, then b is the first byte of an n-byte | 
|---|
| 392 | sequence that encodes a single Unicode scalar value. | 
|---|
| 393 | The data member will be passed as the first argument to the convert function. | 
|---|
| 394 | The convert function is used to convert multibyte sequences; | 
|---|
| 395 | s will point to a n-byte sequence where map[(unsigned char)*s] == -n. | 
|---|
| 396 | The convert function must return the Unicode scalar value | 
|---|
| 397 | represented by this byte sequence or -1 if the byte sequence is malformed. | 
|---|
| 398 | The convert function may be null if the encoding is a single-byte encoding, | 
|---|
| 399 | that is if map[b] >= -1 for all bytes b. | 
|---|
| 400 | When the parser is finished with the encoding, then if release is not null, | 
|---|
| 401 | it will call release passing it the data member; | 
|---|
| 402 | once release has been called, the convert function will not be called again. | 
|---|
| 403 |  | 
|---|
| 404 | Expat places certain restrictions on the encodings that are supported | 
|---|
| 405 | using this mechanism. | 
|---|
| 406 |  | 
|---|
| 407 | 1. Every ASCII character that can appear in a well-formed XML document, | 
|---|
| 408 | other than the characters | 
|---|
| 409 |  | 
|---|
| 410 | $@\^`{}~ | 
|---|
| 411 |  | 
|---|
| 412 | must be represented by a single byte, and that byte must be the | 
|---|
| 413 | same byte that represents that character in ASCII. | 
|---|
| 414 |  | 
|---|
| 415 | 2. No character may require more than 4 bytes to encode. | 
|---|
| 416 |  | 
|---|
| 417 | 3. All characters encoded must have Unicode scalar values <= 0xFFFF, (i.e., | 
|---|
| 418 | characters that would be encoded by surrogates in UTF-16 are  not | 
|---|
| 419 | allowed).  Note that this restriction doesn't apply to the built-in | 
|---|
| 420 | support for UTF-8 and UTF-16. | 
|---|
| 421 |  | 
|---|
| 422 | 4. No Unicode character may be encoded by more than one distinct sequence | 
|---|
| 423 | of bytes. */ | 
|---|
| 424 |  | 
|---|
| 425 | typedef struct { | 
|---|
| 426 | int map[256]; | 
|---|
| 427 | void *data; | 
|---|
| 428 | int (* EXPATENTRY convert)(void *data, const char *s); | 
|---|
| 429 | void (* EXPATENTRY release)(void *data); | 
|---|
| 430 | } XML_Encoding; | 
|---|
| 431 |  | 
|---|
| 432 | /* This is called for an encoding that is unknown to the parser. | 
|---|
| 433 | The encodingHandlerData argument is that which was passed as the | 
|---|
| 434 | second argument to XML_SetUnknownEncodingHandler. | 
|---|
| 435 | The name argument gives the name of the encoding as specified in | 
|---|
| 436 | the encoding declaration. | 
|---|
| 437 | If the callback can provide information about the encoding, | 
|---|
| 438 | it must fill in the XML_Encoding structure, and return 1. | 
|---|
| 439 | Otherwise it must return 0. | 
|---|
| 440 | If info does not describe a suitable encoding, | 
|---|
| 441 | then the parser will return an XML_UNKNOWN_ENCODING error. */ | 
|---|
| 442 |  | 
|---|
| 443 | typedef int (* EXPATENTRY XML_UnknownEncodingHandler)(void *encodingHandlerData, | 
|---|
| 444 | const XML_Char *name, | 
|---|
| 445 | XML_Encoding *info); | 
|---|
| 446 |  | 
|---|
| 447 | void EXPATENTRY | 
|---|
| 448 | XML_SetElementHandler(XML_Parser parser, | 
|---|
| 449 | XML_StartElementHandler start, | 
|---|
| 450 | XML_EndElementHandler end); | 
|---|
| 451 |  | 
|---|
| 452 | void EXPATENTRY | 
|---|
| 453 | XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); | 
|---|
| 454 |  | 
|---|
| 455 | void EXPATENTRY | 
|---|
| 456 | XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); | 
|---|
| 457 |  | 
|---|
| 458 | void EXPATENTRY | 
|---|
| 459 | XML_SetCharacterDataHandler(XML_Parser parser, | 
|---|
| 460 | XML_CharacterDataHandler handler); | 
|---|
| 461 |  | 
|---|
| 462 | void EXPATENTRY | 
|---|
| 463 | XML_SetProcessingInstructionHandler(XML_Parser parser, | 
|---|
| 464 | XML_ProcessingInstructionHandler handler); | 
|---|
| 465 | void EXPATENTRY | 
|---|
| 466 | XML_SetCommentHandler(XML_Parser parser, | 
|---|
| 467 | XML_CommentHandler handler); | 
|---|
| 468 |  | 
|---|
| 469 | void EXPATENTRY | 
|---|
| 470 | XML_SetCdataSectionHandler(XML_Parser parser, | 
|---|
| 471 | XML_StartCdataSectionHandler start, | 
|---|
| 472 | XML_EndCdataSectionHandler end); | 
|---|
| 473 |  | 
|---|
| 474 | void EXPATENTRY | 
|---|
| 475 | XML_SetStartCdataSectionHandler(XML_Parser parser, | 
|---|
| 476 | XML_StartCdataSectionHandler start); | 
|---|
| 477 |  | 
|---|
| 478 | void EXPATENTRY | 
|---|
| 479 | XML_SetEndCdataSectionHandler(XML_Parser parser, | 
|---|
| 480 | XML_EndCdataSectionHandler end); | 
|---|
| 481 |  | 
|---|
| 482 | /* This sets the default handler and also inhibits expansion of | 
|---|
| 483 | internal entities.  The entity reference will be passed to the default | 
|---|
| 484 | handler. */ | 
|---|
| 485 |  | 
|---|
| 486 | void EXPATENTRY | 
|---|
| 487 | XML_SetDefaultHandler(XML_Parser parser, | 
|---|
| 488 | XML_DefaultHandler handler); | 
|---|
| 489 |  | 
|---|
| 490 | /* This sets the default handler but does not inhibit expansion of | 
|---|
| 491 | internal entities.  The entity reference will not be passed to the | 
|---|
| 492 | default handler. */ | 
|---|
| 493 |  | 
|---|
| 494 | void EXPATENTRY | 
|---|
| 495 | XML_SetDefaultHandlerExpand(XML_Parser parser, | 
|---|
| 496 | XML_DefaultHandler handler); | 
|---|
| 497 |  | 
|---|
| 498 | void EXPATENTRY | 
|---|
| 499 | XML_SetDoctypeDeclHandler(XML_Parser parser, | 
|---|
| 500 | XML_StartDoctypeDeclHandler start, | 
|---|
| 501 | XML_EndDoctypeDeclHandler end); | 
|---|
| 502 |  | 
|---|
| 503 | void EXPATENTRY | 
|---|
| 504 | XML_SetStartDoctypeDeclHandler(XML_Parser parser, | 
|---|
| 505 | XML_StartDoctypeDeclHandler start); | 
|---|
| 506 |  | 
|---|
| 507 | void EXPATENTRY | 
|---|
| 508 | XML_SetEndDoctypeDeclHandler(XML_Parser parser, | 
|---|
| 509 | XML_EndDoctypeDeclHandler end); | 
|---|
| 510 |  | 
|---|
| 511 | void EXPATENTRY | 
|---|
| 512 | XML_SetUnparsedEntityDeclHandler(XML_Parser parser, | 
|---|
| 513 | XML_UnparsedEntityDeclHandler handler); | 
|---|
| 514 |  | 
|---|
| 515 | void EXPATENTRY | 
|---|
| 516 | XML_SetNotationDeclHandler(XML_Parser parser, | 
|---|
| 517 | XML_NotationDeclHandler handler); | 
|---|
| 518 |  | 
|---|
| 519 | void EXPATENTRY | 
|---|
| 520 | XML_SetNamespaceDeclHandler(XML_Parser parser, | 
|---|
| 521 | XML_StartNamespaceDeclHandler start, | 
|---|
| 522 | XML_EndNamespaceDeclHandler end); | 
|---|
| 523 |  | 
|---|
| 524 | void EXPATENTRY | 
|---|
| 525 | XML_SetStartNamespaceDeclHandler(XML_Parser parser, | 
|---|
| 526 | XML_StartNamespaceDeclHandler start); | 
|---|
| 527 |  | 
|---|
| 528 | void EXPATENTRY | 
|---|
| 529 | XML_SetEndNamespaceDeclHandler(XML_Parser parser, | 
|---|
| 530 | XML_EndNamespaceDeclHandler end); | 
|---|
| 531 |  | 
|---|
| 532 | void EXPATENTRY | 
|---|
| 533 | XML_SetNotStandaloneHandler(XML_Parser parser, | 
|---|
| 534 | XML_NotStandaloneHandler handler); | 
|---|
| 535 |  | 
|---|
| 536 | void EXPATENTRY | 
|---|
| 537 | XML_SetExternalEntityRefHandler(XML_Parser parser, | 
|---|
| 538 | XML_ExternalEntityRefHandler handler); | 
|---|
| 539 |  | 
|---|
| 540 | /* If a non-null value for arg is specified here, then it will be passed | 
|---|
| 541 | as the first argument to the external entity ref handler instead | 
|---|
| 542 | of the parser object. */ | 
|---|
| 543 | void EXPATENTRY | 
|---|
| 544 | XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); | 
|---|
| 545 |  | 
|---|
| 546 | void EXPATENTRY | 
|---|
| 547 | XML_SetUnknownEncodingHandler(XML_Parser parser, | 
|---|
| 548 | XML_UnknownEncodingHandler handler, | 
|---|
| 549 | void *encodingHandlerData); | 
|---|
| 550 |  | 
|---|
| 551 | /* This can be called within a handler for a start element, end element, | 
|---|
| 552 | processing instruction or character data.  It causes the corresponding | 
|---|
| 553 | markup to be passed to the default handler. */ | 
|---|
| 554 | void EXPATENTRY | 
|---|
| 555 | XML_DefaultCurrent(XML_Parser parser); | 
|---|
| 556 |  | 
|---|
| 557 | /* If do_nst is non-zero, and namespace processing is in effect, and | 
|---|
| 558 | a name has a prefix (i.e. an explicit namespace qualifier) then | 
|---|
| 559 | that name is returned as a triplet in a single | 
|---|
| 560 | string separated by the separator character specified when the parser | 
|---|
| 561 | was created: URI + sep + local_name + sep + prefix. | 
|---|
| 562 |  | 
|---|
| 563 | If do_nst is zero, then namespace information is returned in the | 
|---|
| 564 | default manner (URI + sep + local_name) whether or not the names | 
|---|
| 565 | has a prefix. | 
|---|
| 566 | */ | 
|---|
| 567 |  | 
|---|
| 568 | void EXPATENTRY | 
|---|
| 569 | XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); | 
|---|
| 570 |  | 
|---|
| 571 | /* This value is passed as the userData argument to callbacks. */ | 
|---|
| 572 | void EXPATENTRY | 
|---|
| 573 | XML_SetUserData(XML_Parser parser, void *userData); | 
|---|
| 574 |  | 
|---|
| 575 | /* Returns the last value set by XML_SetUserData or null. */ | 
|---|
| 576 | #define XML_GetUserData(parser) (*(void **)(parser)) | 
|---|
| 577 |  | 
|---|
| 578 | /* This is equivalent to supplying an encoding argument | 
|---|
| 579 | to XML_ParserCreate. It must not be called after XML_Parse | 
|---|
| 580 | or XML_ParseBuffer. */ | 
|---|
| 581 |  | 
|---|
| 582 | int EXPATENTRY | 
|---|
| 583 | XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); | 
|---|
| 584 |  | 
|---|
| 585 | /* If this function is called, then the parser will be passed | 
|---|
| 586 | as the first argument to callbacks instead of userData. | 
|---|
| 587 | The userData will still be accessible using XML_GetUserData. */ | 
|---|
| 588 |  | 
|---|
| 589 | void EXPATENTRY | 
|---|
| 590 | XML_UseParserAsHandlerArg(XML_Parser parser); | 
|---|
| 591 |  | 
|---|
| 592 | /* Sets the base to be used for resolving relative URIs in system | 
|---|
| 593 | identifiers in declarations.  Resolving relative identifiers is left | 
|---|
| 594 | to the application: this value will be passed through as the base | 
|---|
| 595 | argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler | 
|---|
| 596 | and XML_UnparsedEntityDeclHandler. The base argument will be copied. | 
|---|
| 597 | Returns zero if out of memory, non-zero otherwise. */ | 
|---|
| 598 |  | 
|---|
| 599 | int EXPATENTRY | 
|---|
| 600 | XML_SetBase(XML_Parser parser, const XML_Char *base); | 
|---|
| 601 |  | 
|---|
| 602 | const XML_Char * EXPATENTRY | 
|---|
| 603 | XML_GetBase(XML_Parser parser); | 
|---|
| 604 |  | 
|---|
| 605 | /* Returns the number of the attribute/value pairs passed in last call | 
|---|
| 606 | to the XML_StartElementHandler that were specified in the start-tag | 
|---|
| 607 | rather than defaulted. Each attribute/value pair counts as 2; thus | 
|---|
| 608 | this correspondds to an index into the atts array passed to the | 
|---|
| 609 | XML_StartElementHandler. */ | 
|---|
| 610 |  | 
|---|
| 611 | int EXPATENTRY | 
|---|
| 612 | XML_GetSpecifiedAttributeCount(XML_Parser parser); | 
|---|
| 613 |  | 
|---|
| 614 | /* Returns the index of the ID attribute passed in the last call to | 
|---|
| 615 | XML_StartElementHandler, or -1 if there is no ID attribute.  Each | 
|---|
| 616 | attribute/value pair counts as 2; thus this correspondds to an index | 
|---|
| 617 | into the atts array passed to the XML_StartElementHandler. */ | 
|---|
| 618 |  | 
|---|
| 619 | int EXPATENTRY | 
|---|
| 620 | XML_GetIdAttributeIndex(XML_Parser parser); | 
|---|
| 621 |  | 
|---|
| 622 | /* Parses some input. Returns 0 if a fatal error is detected. | 
|---|
| 623 | The last call to XML_Parse must have isFinal true; | 
|---|
| 624 | len may be zero for this call (or any other). */ | 
|---|
| 625 | int EXPATENTRY | 
|---|
| 626 | XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); | 
|---|
| 627 |  | 
|---|
| 628 | void * EXPATENTRY | 
|---|
| 629 | XML_GetBuffer(XML_Parser parser, int len); | 
|---|
| 630 |  | 
|---|
| 631 | int EXPATENTRY | 
|---|
| 632 | XML_ParseBuffer(XML_Parser parser, int len, int isFinal); | 
|---|
| 633 |  | 
|---|
| 634 | /* Creates an XML_Parser object that can parse an external general | 
|---|
| 635 | entity; context is a '\0'-terminated string specifying the parse | 
|---|
| 636 | context; encoding is a '\0'-terminated string giving the name of the | 
|---|
| 637 | externally specified encoding, or null if there is no externally | 
|---|
| 638 | specified encoding.  The context string consists of a sequence of | 
|---|
| 639 | tokens separated by formfeeds (\f); a token consisting of a name | 
|---|
| 640 | specifies that the general entity of the name is open; a token of the | 
|---|
| 641 | form prefix=uri specifies the namespace for a particular prefix; a | 
|---|
| 642 | token of the form =uri specifies the default namespace.  This can be | 
|---|
| 643 | called at any point after the first call to an | 
|---|
| 644 | ExternalEntityRefHandler so longer as the parser has not yet been | 
|---|
| 645 | freed.  The new parser is completely independent and may safely be | 
|---|
| 646 | used in a separate thread.  The handlers and userData are initialized | 
|---|
| 647 | from the parser argument.  Returns 0 if out of memory.  Otherwise | 
|---|
| 648 | returns a new XML_Parser object. */ | 
|---|
| 649 | XML_Parser EXPATENTRY | 
|---|
| 650 | XML_ExternalEntityParserCreate(XML_Parser parser, | 
|---|
| 651 | const XML_Char *context, | 
|---|
| 652 | const XML_Char *encoding); | 
|---|
| 653 |  | 
|---|
| 654 | enum XML_ParamEntityParsing { | 
|---|
| 655 | XML_PARAM_ENTITY_PARSING_NEVER, | 
|---|
| 656 | XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, | 
|---|
| 657 | XML_PARAM_ENTITY_PARSING_ALWAYS | 
|---|
| 658 | }; | 
|---|
| 659 |  | 
|---|
| 660 | /* Controls parsing of parameter entities (including the external DTD | 
|---|
| 661 | subset). If parsing of parameter entities is enabled, then references | 
|---|
| 662 | to external parameter entities (including the external DTD subset) | 
|---|
| 663 | will be passed to the handler set with | 
|---|
| 664 | XML_SetExternalEntityRefHandler.  The context passed will be 0. | 
|---|
| 665 | Unlike external general entities, external parameter entities can only | 
|---|
| 666 | be parsed synchronously.  If the external parameter entity is to be | 
|---|
| 667 | parsed, it must be parsed during the call to the external entity ref | 
|---|
| 668 | handler: the complete sequence of XML_ExternalEntityParserCreate, | 
|---|
| 669 | XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during | 
|---|
| 670 | this call.  After XML_ExternalEntityParserCreate has been called to | 
|---|
| 671 | create the parser for the external parameter entity (context must be 0 | 
|---|
| 672 | for this call), it is illegal to make any calls on the old parser | 
|---|
| 673 | until XML_ParserFree has been called on the newly created parser.  If | 
|---|
| 674 | the library has been compiled without support for parameter entity | 
|---|
| 675 | parsing (ie without XML_DTD being defined), then | 
|---|
| 676 | XML_SetParamEntityParsing will return 0 if parsing of parameter | 
|---|
| 677 | entities is requested; otherwise it will return non-zero. */ | 
|---|
| 678 |  | 
|---|
| 679 | int EXPATENTRY | 
|---|
| 680 | XML_SetParamEntityParsing(XML_Parser parser, | 
|---|
| 681 | enum XML_ParamEntityParsing parsing); | 
|---|
| 682 |  | 
|---|
| 683 | /* XMLERROR { | 
|---|
| 684 | ERROR_EXPAT_NONE, | 
|---|
| 685 | ERROR_EXPAT_NO_MEMORY, | 
|---|
| 686 | ERROR_EXPAT_SYNTAX, | 
|---|
| 687 | ERROR_EXPAT_NO_ELEMENTS, | 
|---|
| 688 | ERROR_EXPAT_INVALID_TOKEN, | 
|---|
| 689 | ERROR_EXPAT_UNCLOSED_TOKEN, | 
|---|
| 690 | ERROR_EXPAT_PARTIAL_CHAR, | 
|---|
| 691 | ERROR_EXPAT_TAG_MISMATCH, | 
|---|
| 692 | ERROR_EXPAT_DUPLICATE_ATTRIBUTE, | 
|---|
| 693 | ERROR_EXPAT_JUNK_AFTER_DOC_ELEMENT, | 
|---|
| 694 | ERROR_EXPAT_PARAM_ENTITY_REF, | 
|---|
| 695 | ERROR_EXPAT_UNDEFINED_ENTITY, | 
|---|
| 696 | ERROR_EXPAT_RECURSIVE_ENTITY_REF, | 
|---|
| 697 | ERROR_EXPAT_ASYNC_ENTITY, | 
|---|
| 698 | ERROR_EXPAT_BAD_CHAR_REF, | 
|---|
| 699 | ERROR_EXPAT_BINARY_ENTITY_REF, | 
|---|
| 700 | ERROR_EXPAT_ATTRIBUTE_EXTERNAL_ENTITY_REF, | 
|---|
| 701 | ERROR_EXPAT_MISPLACED_XML_PI, | 
|---|
| 702 | ERROR_EXPAT_UNKNOWN_ENCODING, | 
|---|
| 703 | ERROR_EXPAT_INCORRECT_ENCODING, | 
|---|
| 704 | ERROR_EXPAT_UNCLOSED_CDATA_SECTION, | 
|---|
| 705 | ERROR_EXPAT_EXTERNAL_ENTITY_HANDLING, | 
|---|
| 706 | ERROR_EXPAT_NOT_STANDALONE, | 
|---|
| 707 | ERROR_EXPAT_UNEXPECTED_STATE | 
|---|
| 708 | }; */ | 
|---|
| 709 |  | 
|---|
| 710 | #define ERROR_XML_FIRST         40000   // first error code used | 
|---|
| 711 |  | 
|---|
| 712 | typedef unsigned long XMLERROR;     // V0.9.12 (2001-05-20) [umoeller] | 
|---|
| 713 |  | 
|---|
| 714 | #define ERROR_EXPAT_NONE                0 | 
|---|
| 715 | #define ERROR_EXPAT_NO_MEMORY           (ERROR_XML_FIRST) | 
|---|
| 716 | #define ERROR_EXPAT_SYNTAX              (ERROR_XML_FIRST + 1) | 
|---|
| 717 | #define ERROR_EXPAT_NO_ELEMENTS         (ERROR_XML_FIRST + 2) | 
|---|
| 718 | #define ERROR_EXPAT_INVALID_TOKEN       (ERROR_XML_FIRST + 3) | 
|---|
| 719 | #define ERROR_EXPAT_UNCLOSED_TOKEN      (ERROR_XML_FIRST + 4) | 
|---|
| 720 | #define ERROR_EXPAT_PARTIAL_CHAR        (ERROR_XML_FIRST + 5) | 
|---|
| 721 | #define ERROR_EXPAT_TAG_MISMATCH        (ERROR_XML_FIRST + 6) | 
|---|
| 722 | #define ERROR_EXPAT_DUPLICATE_ATTRIBUTE (ERROR_XML_FIRST + 7) | 
|---|
| 723 | #define ERROR_EXPAT_JUNK_AFTER_DOC_ELEMENT (ERROR_XML_FIRST + 8) | 
|---|
| 724 | #define ERROR_EXPAT_PARAM_ENTITY_REF    (ERROR_XML_FIRST + 10) | 
|---|
| 725 | #define ERROR_EXPAT_UNDEFINED_ENTITY    (ERROR_XML_FIRST + 11) | 
|---|
| 726 | #define ERROR_EXPAT_RECURSIVE_ENTITY_REF (ERROR_XML_FIRST + 12) | 
|---|
| 727 | #define ERROR_EXPAT_ASYNC_ENTITY        (ERROR_XML_FIRST + 13) | 
|---|
| 728 | #define ERROR_EXPAT_BAD_CHAR_REF        (ERROR_XML_FIRST + 14) | 
|---|
| 729 | #define ERROR_EXPAT_BINARY_ENTITY_REF   (ERROR_XML_FIRST + 15) | 
|---|
| 730 | #define ERROR_EXPAT_ATTRIBUTE_EXTERNAL_ENTITY_REF (ERROR_XML_FIRST + 16) | 
|---|
| 731 | #define ERROR_EXPAT_MISPLACED_XML_PI    (ERROR_XML_FIRST + 17) | 
|---|
| 732 | #define ERROR_EXPAT_UNKNOWN_ENCODING    (ERROR_XML_FIRST + 18) | 
|---|
| 733 | #define ERROR_EXPAT_INCORRECT_ENCODING  (ERROR_XML_FIRST + 19) | 
|---|
| 734 | #define ERROR_EXPAT_UNCLOSED_CDATA_SECTION (ERROR_XML_FIRST + 20) | 
|---|
| 735 | #define ERROR_EXPAT_EXTERNAL_ENTITY_HANDLING (ERROR_XML_FIRST + 21) | 
|---|
| 736 | #define ERROR_EXPAT_NOT_STANDALONE      (ERROR_XML_FIRST + 22) | 
|---|
| 737 | #define ERROR_EXPAT_UNEXPECTED_STATE    (ERROR_XML_FIRST + 23) | 
|---|
| 738 |  | 
|---|
| 739 | /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode | 
|---|
| 740 | returns information about the error. */ | 
|---|
| 741 |  | 
|---|
| 742 | XMLERROR EXPATENTRY | 
|---|
| 743 | XML_GetErrorCode(XML_Parser parser); | 
|---|
| 744 |  | 
|---|
| 745 | /* These functions return information about the current parse location. | 
|---|
| 746 | They may be called when XML_Parse or XML_ParseBuffer return 0; | 
|---|
| 747 | in this case the location is the location of the character at which | 
|---|
| 748 | the error was detected. | 
|---|
| 749 | They may also be called from any other callback called to report | 
|---|
| 750 | some parse event; in this the location is the location of the first | 
|---|
| 751 | of the sequence of characters that generated the event. */ | 
|---|
| 752 |  | 
|---|
| 753 | int EXPATENTRY XML_GetCurrentLineNumber(XML_Parser parser); | 
|---|
| 754 | int EXPATENTRY XML_GetCurrentColumnNumber(XML_Parser parser); | 
|---|
| 755 | long EXPATENTRY XML_GetCurrentByteIndex(XML_Parser parser); | 
|---|
| 756 |  | 
|---|
| 757 | /* Return the number of bytes in the current event. | 
|---|
| 758 | Returns 0 if the event is in an internal entity. */ | 
|---|
| 759 |  | 
|---|
| 760 | int EXPATENTRY | 
|---|
| 761 | XML_GetCurrentByteCount(XML_Parser parser); | 
|---|
| 762 |  | 
|---|
| 763 | /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets | 
|---|
| 764 | the integer pointed to by offset to the offset within this buffer | 
|---|
| 765 | of the current parse position, and sets the integer pointed to by size | 
|---|
| 766 | to the size of this buffer (the number of input bytes). Otherwise | 
|---|
| 767 | returns a null pointer. Also returns a null pointer if a parse isn't | 
|---|
| 768 | active. | 
|---|
| 769 |  | 
|---|
| 770 | NOTE: The character pointer returned should not be used outside | 
|---|
| 771 | the handler that makes the call. */ | 
|---|
| 772 |  | 
|---|
| 773 | const char * EXPATENTRY | 
|---|
| 774 | XML_GetInputContext(XML_Parser parser, | 
|---|
| 775 | int *offset, | 
|---|
| 776 | int *size); | 
|---|
| 777 |  | 
|---|
| 778 | /* For backwards compatibility with previous versions. */ | 
|---|
| 779 | #define XML_GetErrorLineNumber XML_GetCurrentLineNumber | 
|---|
| 780 | #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber | 
|---|
| 781 | #define XML_GetErrorByteIndex XML_GetCurrentByteIndex | 
|---|
| 782 |  | 
|---|
| 783 | /* Frees memory used by the parser. */ | 
|---|
| 784 | void EXPATENTRY | 
|---|
| 785 | XML_ParserFree(XML_Parser parser); | 
|---|
| 786 |  | 
|---|
| 787 | /* Returns a string describing the error. */ | 
|---|
| 788 | const XML_LChar * EXPATENTRY | 
|---|
| 789 | XML_ErrorString(int code); | 
|---|
| 790 |  | 
|---|
| 791 | /* Return a string containing the version number of this expat */ | 
|---|
| 792 | const XML_LChar * EXPATENTRY | 
|---|
| 793 | XML_ExpatVersion(void); | 
|---|
| 794 |  | 
|---|
| 795 | typedef struct { | 
|---|
| 796 | int major; | 
|---|
| 797 | int minor; | 
|---|
| 798 | int micro; | 
|---|
| 799 | } XML_Expat_Version; | 
|---|
| 800 |  | 
|---|
| 801 | /* Return an XML_Expat_Version structure containing numeric version | 
|---|
| 802 | number information for this version of expat */ | 
|---|
| 803 |  | 
|---|
| 804 | XML_Expat_Version EXPATENTRY | 
|---|
| 805 | XML_ExpatVersionInfo(void); | 
|---|
| 806 |  | 
|---|
| 807 | #define XML_MAJOR_VERSION @EXPAT_MAJOR_VERSION@ | 
|---|
| 808 | #define XML_MINOR_VERSION @EXPAT_MINOR_VERSION@ | 
|---|
| 809 | #define XML_MICRO_VERSION @EXPAT_EDIT@ | 
|---|
| 810 |  | 
|---|
| 811 | #ifdef __cplusplus | 
|---|
| 812 | } | 
|---|
| 813 | #endif | 
|---|
| 814 |  | 
|---|
| 815 | #endif /* not XmlParse_INCLUDED */ | 
|---|