Geant4 Cross Reference |
1 /* << 1 /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd 2 __ __ << 2 See the file COPYING for copying permission. 3 ___\ \/ /_ __ __ _| << 4 / _ \\ /| '_ \ / _` | << 5 | __// \| |_) | (_| | << 6 \___/_/\_\ .__/ \__,_| << 7 |_| XML parse << 8 << 9 Copyright (c) 1997-2000 Thai Open Source So << 10 Copyright (c) 2000 Clark Cooper <coope << 11 Copyright (c) 2000-2005 Fred L. Drake, Jr. << 12 Copyright (c) 2001-2002 Greg Stein <gstein@ << 13 Copyright (c) 2002-2016 Karl Waclawek <karl << 14 Copyright (c) 2016-2022 Sebastian Pipping < << 15 Copyright (c) 2016 Cristian RodrÃguez << 16 Copyright (c) 2016 Thomas Beutlich <tc << 17 Copyright (c) 2017 Rhodri James <rhodr << 18 Copyright (c) 2022 Thijs Schreijer <th << 19 Licensed under the MIT license: << 20 << 21 Permission is hereby granted, free of cha << 22 a copy of this software and associat << 23 "Software"), to deal in the Software w << 24 without limitation the rights to use, c << 25 distribute, sublicense, and/or sell copies << 26 persons to whom the Software is furnish << 27 following conditions: << 28 << 29 The above copyright notice and this permis << 30 in all copies or substantial portions of th << 31 << 32 THE SOFTWARE IS PROVIDED "AS IS", WIT << 33 EXPRESS OR IMPLIED, INCLUDING BUT NOT L << 34 MERCHANTABILITY, FITNESS FOR A PARTICULAR P << 35 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HO << 36 DAMAGES OR OTHER LIABILITY, WHETHER IN AN << 37 OTHERWISE, ARISING FROM, OUT OF OR IN CONNE << 38 USE OR OTHER DEALINGS IN THE SOFTWARE. << 39 */ 3 */ 40 4 41 #ifndef Expat_INCLUDED 5 #ifndef Expat_INCLUDED 42 #define Expat_INCLUDED 1 6 #define Expat_INCLUDED 1 43 7 >> 8 #ifdef __VMS >> 9 /* 0 1 2 3 0 1 2 3 >> 10 1234567890123456789012345678901 1234567890123456789012345678901 */ >> 11 #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler >> 12 #define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler >> 13 #define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler >> 14 #define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg >> 15 #endif >> 16 44 #include <stdlib.h> 17 #include <stdlib.h> 45 #include "expat_external.h" 18 #include "expat_external.h" 46 19 47 #ifdef __cplusplus 20 #ifdef __cplusplus 48 extern "C" { 21 extern "C" { 49 #endif 22 #endif 50 23 51 struct XML_ParserStruct; 24 struct XML_ParserStruct; 52 typedef struct XML_ParserStruct *XML_Parser; 25 typedef struct XML_ParserStruct *XML_Parser; 53 26 >> 27 /* Should this be defined using stdbool.h when C99 is available? */ 54 typedef unsigned char XML_Bool; 28 typedef unsigned char XML_Bool; 55 #define XML_TRUE ((XML_Bool)1) << 29 #define XML_TRUE ((XML_Bool) 1) 56 #define XML_FALSE ((XML_Bool)0) << 30 #define XML_FALSE ((XML_Bool) 0) 57 31 58 /* The XML_Status enum gives the possible retu 32 /* The XML_Status enum gives the possible return values for several 59 API functions. The preprocessor #defines a 33 API functions. The preprocessor #defines are included so this 60 stanza can be added to code that still need 34 stanza can be added to code that still needs to support older 61 versions of Expat 1.95.x: 35 versions of Expat 1.95.x: 62 36 63 #ifndef XML_STATUS_OK 37 #ifndef XML_STATUS_OK 64 #define XML_STATUS_OK 1 38 #define XML_STATUS_OK 1 65 #define XML_STATUS_ERROR 0 39 #define XML_STATUS_ERROR 0 66 #endif 40 #endif 67 41 68 Otherwise, the #define hackery is quite ugl 42 Otherwise, the #define hackery is quite ugly and would have been 69 dropped. 43 dropped. 70 */ 44 */ 71 enum XML_Status { 45 enum XML_Status { 72 XML_STATUS_ERROR = 0, 46 XML_STATUS_ERROR = 0, 73 #define XML_STATUS_ERROR XML_STATUS_ERROR 47 #define XML_STATUS_ERROR XML_STATUS_ERROR 74 XML_STATUS_OK = 1, 48 XML_STATUS_OK = 1, 75 #define XML_STATUS_OK XML_STATUS_OK 49 #define XML_STATUS_OK XML_STATUS_OK 76 XML_STATUS_SUSPENDED = 2 50 XML_STATUS_SUSPENDED = 2 77 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPEN 51 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED 78 }; 52 }; 79 53 80 enum XML_Error { 54 enum XML_Error { 81 XML_ERROR_NONE, 55 XML_ERROR_NONE, 82 XML_ERROR_NO_MEMORY, 56 XML_ERROR_NO_MEMORY, 83 XML_ERROR_SYNTAX, 57 XML_ERROR_SYNTAX, 84 XML_ERROR_NO_ELEMENTS, 58 XML_ERROR_NO_ELEMENTS, 85 XML_ERROR_INVALID_TOKEN, 59 XML_ERROR_INVALID_TOKEN, 86 XML_ERROR_UNCLOSED_TOKEN, 60 XML_ERROR_UNCLOSED_TOKEN, 87 XML_ERROR_PARTIAL_CHAR, 61 XML_ERROR_PARTIAL_CHAR, 88 XML_ERROR_TAG_MISMATCH, 62 XML_ERROR_TAG_MISMATCH, 89 XML_ERROR_DUPLICATE_ATTRIBUTE, 63 XML_ERROR_DUPLICATE_ATTRIBUTE, 90 XML_ERROR_JUNK_AFTER_DOC_ELEMENT, 64 XML_ERROR_JUNK_AFTER_DOC_ELEMENT, 91 XML_ERROR_PARAM_ENTITY_REF, 65 XML_ERROR_PARAM_ENTITY_REF, 92 XML_ERROR_UNDEFINED_ENTITY, 66 XML_ERROR_UNDEFINED_ENTITY, 93 XML_ERROR_RECURSIVE_ENTITY_REF, 67 XML_ERROR_RECURSIVE_ENTITY_REF, 94 XML_ERROR_ASYNC_ENTITY, 68 XML_ERROR_ASYNC_ENTITY, 95 XML_ERROR_BAD_CHAR_REF, 69 XML_ERROR_BAD_CHAR_REF, 96 XML_ERROR_BINARY_ENTITY_REF, 70 XML_ERROR_BINARY_ENTITY_REF, 97 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, 71 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, 98 XML_ERROR_MISPLACED_XML_PI, 72 XML_ERROR_MISPLACED_XML_PI, 99 XML_ERROR_UNKNOWN_ENCODING, 73 XML_ERROR_UNKNOWN_ENCODING, 100 XML_ERROR_INCORRECT_ENCODING, 74 XML_ERROR_INCORRECT_ENCODING, 101 XML_ERROR_UNCLOSED_CDATA_SECTION, 75 XML_ERROR_UNCLOSED_CDATA_SECTION, 102 XML_ERROR_EXTERNAL_ENTITY_HANDLING, 76 XML_ERROR_EXTERNAL_ENTITY_HANDLING, 103 XML_ERROR_NOT_STANDALONE, 77 XML_ERROR_NOT_STANDALONE, 104 XML_ERROR_UNEXPECTED_STATE, 78 XML_ERROR_UNEXPECTED_STATE, 105 XML_ERROR_ENTITY_DECLARED_IN_PE, 79 XML_ERROR_ENTITY_DECLARED_IN_PE, 106 XML_ERROR_FEATURE_REQUIRES_XML_DTD, 80 XML_ERROR_FEATURE_REQUIRES_XML_DTD, 107 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, 81 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, 108 /* Added in 1.95.7. */ 82 /* Added in 1.95.7. */ 109 XML_ERROR_UNBOUND_PREFIX, 83 XML_ERROR_UNBOUND_PREFIX, 110 /* Added in 1.95.8. */ 84 /* Added in 1.95.8. */ 111 XML_ERROR_UNDECLARING_PREFIX, 85 XML_ERROR_UNDECLARING_PREFIX, 112 XML_ERROR_INCOMPLETE_PE, 86 XML_ERROR_INCOMPLETE_PE, 113 XML_ERROR_XML_DECL, 87 XML_ERROR_XML_DECL, 114 XML_ERROR_TEXT_DECL, 88 XML_ERROR_TEXT_DECL, 115 XML_ERROR_PUBLICID, 89 XML_ERROR_PUBLICID, 116 XML_ERROR_SUSPENDED, 90 XML_ERROR_SUSPENDED, 117 XML_ERROR_NOT_SUSPENDED, 91 XML_ERROR_NOT_SUSPENDED, 118 XML_ERROR_ABORTED, 92 XML_ERROR_ABORTED, 119 XML_ERROR_FINISHED, 93 XML_ERROR_FINISHED, 120 XML_ERROR_SUSPEND_PE, 94 XML_ERROR_SUSPEND_PE, 121 /* Added in 2.0. */ 95 /* Added in 2.0. */ 122 XML_ERROR_RESERVED_PREFIX_XML, 96 XML_ERROR_RESERVED_PREFIX_XML, 123 XML_ERROR_RESERVED_PREFIX_XMLNS, 97 XML_ERROR_RESERVED_PREFIX_XMLNS, 124 XML_ERROR_RESERVED_NAMESPACE_URI, << 98 XML_ERROR_RESERVED_NAMESPACE_URI 125 /* Added in 2.2.1. */ << 126 XML_ERROR_INVALID_ARGUMENT, << 127 /* Added in 2.3.0. */ << 128 XML_ERROR_NO_BUFFER, << 129 /* Added in 2.4.0. */ << 130 XML_ERROR_AMPLIFICATION_LIMIT_BREACH << 131 }; 99 }; 132 100 133 enum XML_Content_Type { 101 enum XML_Content_Type { 134 XML_CTYPE_EMPTY = 1, 102 XML_CTYPE_EMPTY = 1, 135 XML_CTYPE_ANY, 103 XML_CTYPE_ANY, 136 XML_CTYPE_MIXED, 104 XML_CTYPE_MIXED, 137 XML_CTYPE_NAME, 105 XML_CTYPE_NAME, 138 XML_CTYPE_CHOICE, 106 XML_CTYPE_CHOICE, 139 XML_CTYPE_SEQ 107 XML_CTYPE_SEQ 140 }; 108 }; 141 109 142 enum XML_Content_Quant { 110 enum XML_Content_Quant { 143 XML_CQUANT_NONE, 111 XML_CQUANT_NONE, 144 XML_CQUANT_OPT, 112 XML_CQUANT_OPT, 145 XML_CQUANT_REP, 113 XML_CQUANT_REP, 146 XML_CQUANT_PLUS 114 XML_CQUANT_PLUS 147 }; 115 }; 148 116 149 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY 117 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be 150 XML_CQUANT_NONE, and the other fields will 118 XML_CQUANT_NONE, and the other fields will be zero or NULL. 151 If type == XML_CTYPE_MIXED, then quant will 119 If type == XML_CTYPE_MIXED, then quant will be NONE or REP and 152 numchildren will contain number of elements 120 numchildren will contain number of elements that may be mixed in 153 and children point to an array of XML_Conte 121 and children point to an array of XML_Content cells that will be 154 all of XML_CTYPE_NAME type with no quantifi 122 all of XML_CTYPE_NAME type with no quantification. 155 123 156 If type == XML_CTYPE_NAME, then the name po 124 If type == XML_CTYPE_NAME, then the name points to the name, and 157 the numchildren field will be zero and chil 125 the numchildren field will be zero and children will be NULL. The 158 quant fields indicates any quantifiers plac 126 quant fields indicates any quantifiers placed on the name. 159 127 160 CHOICE and SEQ will have name NULL, the num 128 CHOICE and SEQ will have name NULL, the number of children in 161 numchildren and children will point, recurs 129 numchildren and children will point, recursively, to an array 162 of XML_Content cells. 130 of XML_Content cells. 163 131 164 The EMPTY, ANY, and MIXED types will only o 132 The EMPTY, ANY, and MIXED types will only occur at top level. 165 */ 133 */ 166 134 167 typedef struct XML_cp XML_Content; 135 typedef struct XML_cp XML_Content; 168 136 169 struct XML_cp { 137 struct XML_cp { 170 enum XML_Content_Type type; << 138 enum XML_Content_Type type; 171 enum XML_Content_Quant quant; << 139 enum XML_Content_Quant quant; 172 XML_Char *name; << 140 XML_Char * name; 173 unsigned int numchildren; << 141 unsigned int numchildren; 174 XML_Content *children; << 142 XML_Content * children; 175 }; 143 }; 176 144 >> 145 177 /* This is called for an element declaration. 146 /* This is called for an element declaration. See above for 178 description of the model argument. It's the << 147 description of the model argument. It's the caller's responsibility 179 to free model when finished with it. See XM << 148 to free model when finished with it. 180 There is no need to free the model from the << 181 around and freed at a later stage. << 182 */ 149 */ 183 typedef void(XMLCALL *XML_ElementDeclHandler)( << 150 typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, 184 << 151 const XML_Char *name, 185 << 152 XML_Content *model); 186 153 187 XMLPARSEAPI(void) 154 XMLPARSEAPI(void) 188 XML_SetElementDeclHandler(XML_Parser parser, X << 155 XML_SetElementDeclHandler(XML_Parser parser, >> 156 XML_ElementDeclHandler eldecl); 189 157 190 /* The Attlist declaration handler is called f 158 /* The Attlist declaration handler is called for *each* attribute. So 191 a single Attlist declaration with multiple 159 a single Attlist declaration with multiple attributes declared will 192 generate multiple calls to this handler. Th 160 generate multiple calls to this handler. The "default" parameter 193 may be NULL in the case of the "#IMPLIED" o 161 may be NULL in the case of the "#IMPLIED" or "#REQUIRED" 194 keyword. The "isrequired" parameter will be 162 keyword. The "isrequired" parameter will be true and the default 195 value will be NULL in the case of "#REQUIRE 163 value will be NULL in the case of "#REQUIRED". If "isrequired" is 196 true and default is non-NULL, then this is 164 true and default is non-NULL, then this is a "#FIXED" default. 197 */ 165 */ 198 typedef void(XMLCALL *XML_AttlistDeclHandler)( << 166 typedef void (XMLCALL *XML_AttlistDeclHandler) ( 199 void *userData, const XML_Char *elname, co << 167 void *userData, 200 const XML_Char *att_type, const XML_Char * << 168 const XML_Char *elname, >> 169 const XML_Char *attname, >> 170 const XML_Char *att_type, >> 171 const XML_Char *dflt, >> 172 int isrequired); 201 173 202 XMLPARSEAPI(void) 174 XMLPARSEAPI(void) 203 XML_SetAttlistDeclHandler(XML_Parser parser, X << 175 XML_SetAttlistDeclHandler(XML_Parser parser, >> 176 XML_AttlistDeclHandler attdecl); 204 177 205 /* The XML declaration handler is called for * 178 /* The XML declaration handler is called for *both* XML declarations 206 and text declarations. The way to distingui 179 and text declarations. The way to distinguish is that the version 207 parameter will be NULL for text declaration 180 parameter will be NULL for text declarations. The encoding 208 parameter may be NULL for XML declarations. 181 parameter may be NULL for XML declarations. The standalone 209 parameter will be -1, 0, or 1 indicating re 182 parameter will be -1, 0, or 1 indicating respectively that there 210 was no standalone parameter in the declarat 183 was no standalone parameter in the declaration, that it was given 211 as no, or that it was given as yes. 184 as no, or that it was given as yes. 212 */ 185 */ 213 typedef void(XMLCALL *XML_XmlDeclHandler)(void << 186 typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, 214 cons << 187 const XML_Char *version, 215 cons << 188 const XML_Char *encoding, 216 int << 189 int standalone); 217 190 218 XMLPARSEAPI(void) 191 XMLPARSEAPI(void) 219 XML_SetXmlDeclHandler(XML_Parser parser, XML_X << 192 XML_SetXmlDeclHandler(XML_Parser parser, >> 193 XML_XmlDeclHandler xmldecl); >> 194 220 195 221 typedef struct { 196 typedef struct { 222 void *(*malloc_fcn)(size_t size); 197 void *(*malloc_fcn)(size_t size); 223 void *(*realloc_fcn)(void *ptr, size_t size) 198 void *(*realloc_fcn)(void *ptr, size_t size); 224 void (*free_fcn)(void *ptr); 199 void (*free_fcn)(void *ptr); 225 } XML_Memory_Handling_Suite; 200 } XML_Memory_Handling_Suite; 226 201 227 /* Constructs a new parser; encoding is the en 202 /* Constructs a new parser; encoding is the encoding specified by the 228 external protocol or NULL if there is none 203 external protocol or NULL if there is none specified. 229 */ 204 */ 230 XMLPARSEAPI(XML_Parser) 205 XMLPARSEAPI(XML_Parser) 231 XML_ParserCreate(const XML_Char *encoding); 206 XML_ParserCreate(const XML_Char *encoding); 232 207 233 /* Constructs a new parser and namespace proce 208 /* Constructs a new parser and namespace processor. Element type 234 names and attribute names that belong to a 209 names and attribute names that belong to a namespace will be 235 expanded; unprefixed attribute names are ne 210 expanded; unprefixed attribute names are never expanded; unprefixed 236 element type names are expanded only if the 211 element type names are expanded only if there is a default 237 namespace. The expanded name is the concate 212 namespace. The expanded name is the concatenation of the namespace 238 URI, the namespace separator character, and 213 URI, the namespace separator character, and the local part of the 239 name. If the namespace separator is '\0' t 214 name. If the namespace separator is '\0' then the namespace URI 240 and the local part will be concatenated wit 215 and the local part will be concatenated without any separator. 241 It is a programming error to use the separa 216 It is a programming error to use the separator '\0' with namespace 242 triplets (see XML_SetReturnNSTriplet). 217 triplets (see XML_SetReturnNSTriplet). 243 If a namespace separator is chosen that can << 244 part of an XML name, splitting an expanded << 245 1, 2 or 3 original parts on application lev << 246 may end up vulnerable, so these are advised << 247 a namespace separator are e.g. '\n' (line f << 248 << 249 Note that Expat does not validate namespace << 250 against RFC 3986 today (and is not required << 251 the XML 1.0 namespaces specification) but i << 252 in future releases. Before that, an applic << 253 be ready to receive namespace URIs containi << 254 */ 218 */ 255 XMLPARSEAPI(XML_Parser) 219 XMLPARSEAPI(XML_Parser) 256 XML_ParserCreateNS(const XML_Char *encoding, X 220 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); 257 221 >> 222 258 /* Constructs a new parser using the memory ma 223 /* Constructs a new parser using the memory management suite referred to 259 by memsuite. If memsuite is NULL, then use 224 by memsuite. If memsuite is NULL, then use the standard library memory 260 suite. If namespaceSeparator is non-NULL it 225 suite. If namespaceSeparator is non-NULL it creates a parser with 261 namespace processing as described above. Th 226 namespace processing as described above. The character pointed at 262 will serve as the namespace separator. 227 will serve as the namespace separator. 263 228 264 All further memory operations used for the 229 All further memory operations used for the created parser will come from 265 the given suite. 230 the given suite. 266 */ 231 */ 267 XMLPARSEAPI(XML_Parser) 232 XMLPARSEAPI(XML_Parser) 268 XML_ParserCreate_MM(const XML_Char *encoding, 233 XML_ParserCreate_MM(const XML_Char *encoding, 269 const XML_Memory_Handling_ 234 const XML_Memory_Handling_Suite *memsuite, 270 const XML_Char *namespaceS 235 const XML_Char *namespaceSeparator); 271 236 272 /* Prepare a parser object to be re-used. Thi 237 /* Prepare a parser object to be re-used. This is particularly 273 valuable when memory allocation overhead is << 238 valuable when memory allocation overhead is disproportionatly high, 274 such as when a large number of small documn 239 such as when a large number of small documnents need to be parsed. 275 All handlers are cleared from the parser, e 240 All handlers are cleared from the parser, except for the 276 unknownEncodingHandler. The parser's extern 241 unknownEncodingHandler. The parser's external state is re-initialized 277 except for the values of ns and ns_triplets 242 except for the values of ns and ns_triplets. 278 243 279 Added in Expat 1.95.3. 244 Added in Expat 1.95.3. 280 */ 245 */ 281 XMLPARSEAPI(XML_Bool) 246 XMLPARSEAPI(XML_Bool) 282 XML_ParserReset(XML_Parser parser, const XML_C 247 XML_ParserReset(XML_Parser parser, const XML_Char *encoding); 283 248 284 /* atts is array of name/value pairs, terminat 249 /* atts is array of name/value pairs, terminated by 0; 285 names and values are 0 terminated. 250 names and values are 0 terminated. 286 */ 251 */ 287 typedef void(XMLCALL *XML_StartElementHandler) << 252 typedef void (XMLCALL *XML_StartElementHandler) (void *userData, 288 << 253 const XML_Char *name, 289 << 254 const XML_Char **atts); >> 255 >> 256 typedef void (XMLCALL *XML_EndElementHandler) (void *userData, >> 257 const XML_Char *name); 290 258 291 typedef void(XMLCALL *XML_EndElementHandler)(v << 292 c << 293 259 294 /* s is not 0 terminated. */ 260 /* s is not 0 terminated. */ 295 typedef void(XMLCALL *XML_CharacterDataHandler << 261 typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, 296 << 262 const XML_Char *s, >> 263 int len); 297 264 298 /* target and data are 0 terminated */ 265 /* target and data are 0 terminated */ 299 typedef void(XMLCALL *XML_ProcessingInstructio << 266 typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( 300 << 267 void *userData, 301 << 268 const XML_Char *target, >> 269 const XML_Char *data); 302 270 303 /* data is 0 terminated */ 271 /* data is 0 terminated */ 304 typedef void(XMLCALL *XML_CommentHandler)(void << 272 typedef void (XMLCALL *XML_CommentHandler) (void *userData, >> 273 const XML_Char *data); 305 274 306 typedef void(XMLCALL *XML_StartCdataSectionHan << 275 typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); 307 typedef void(XMLCALL *XML_EndCdataSectionHandl << 276 typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); 308 277 309 /* This is called for any characters in the XM 278 /* This is called for any characters in the XML document for which 310 there is no applicable handler. This inclu 279 there is no applicable handler. This includes both characters that 311 are part of markup which is of a kind that 280 are part of markup which is of a kind that is not reported 312 (comments, markup declarations), or charact 281 (comments, markup declarations), or characters that are part of a 313 construct which could be reported but for w 282 construct which could be reported but for which no handler has been 314 supplied. The characters are passed exactly 283 supplied. The characters are passed exactly as they were in the XML 315 document except that they will be encoded i 284 document except that they will be encoded in UTF-8 or UTF-16. 316 Line boundaries are not normalized. Note th 285 Line boundaries are not normalized. Note that a byte order mark 317 character is not passed to the default hand 286 character is not passed to the default handler. There are no 318 guarantees about how characters are divided 287 guarantees about how characters are divided between calls to the 319 default handler: for example, a comment mig 288 default handler: for example, a comment might be split between 320 multiple calls. 289 multiple calls. 321 */ 290 */ 322 typedef void(XMLCALL *XML_DefaultHandler)(void << 291 typedef void (XMLCALL *XML_DefaultHandler) (void *userData, 323 int << 292 const XML_Char *s, >> 293 int len); 324 294 325 /* This is called for the start of the DOCTYPE 295 /* This is called for the start of the DOCTYPE declaration, before 326 any DTD or internal subset is parsed. 296 any DTD or internal subset is parsed. 327 */ 297 */ 328 typedef void(XMLCALL *XML_StartDoctypeDeclHand << 298 typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( 329 << 299 void *userData, 330 << 300 const XML_Char *doctypeName, 331 << 301 const XML_Char *sysid, 332 << 302 const XML_Char *pubid, >> 303 int has_internal_subset); 333 304 334 /* This is called for the end of the DOCTYPE d << 305 /* This is called for the start of the DOCTYPE declaration when the 335 closing > is encountered, but after process 306 closing > is encountered, but after processing any external 336 subset. 307 subset. 337 */ 308 */ 338 typedef void(XMLCALL *XML_EndDoctypeDeclHandle << 309 typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); 339 310 340 /* This is called for entity declarations. The 311 /* This is called for entity declarations. The is_parameter_entity 341 argument will be non-zero if the entity is 312 argument will be non-zero if the entity is a parameter entity, zero 342 otherwise. 313 otherwise. 343 314 344 For internal entities (<!ENTITY foo "bar">) 315 For internal entities (<!ENTITY foo "bar">), value will 345 be non-NULL and systemId, publicID, and not 316 be non-NULL and systemId, publicID, and notationName will be NULL. 346 The value string is NOT null-terminated; th << 317 The value string is NOT nul-terminated; the length is provided in 347 the value_length argument. Since it is lega 318 the value_length argument. Since it is legal to have zero-length 348 values, do not use this argument to test fo 319 values, do not use this argument to test for internal entities. 349 320 350 For external entities, value will be NULL a 321 For external entities, value will be NULL and systemId will be 351 non-NULL. The publicId argument will be NUL 322 non-NULL. The publicId argument will be NULL unless a public 352 identifier was provided. The notationName a 323 identifier was provided. The notationName argument will have a 353 non-NULL value only for unparsed entity dec 324 non-NULL value only for unparsed entity declarations. 354 325 355 Note that is_parameter_entity can't be chan 326 Note that is_parameter_entity can't be changed to XML_Bool, since 356 that would break binary compatibility. 327 that would break binary compatibility. 357 */ 328 */ 358 typedef void(XMLCALL *XML_EntityDeclHandler)( << 329 typedef void (XMLCALL *XML_EntityDeclHandler) ( 359 void *userData, const XML_Char *entityName << 330 void *userData, 360 const XML_Char *value, int value_length, c << 331 const XML_Char *entityName, 361 const XML_Char *systemId, const XML_Char * << 332 int is_parameter_entity, 362 const XML_Char *notationName); << 333 const XML_Char *value, >> 334 int value_length, >> 335 const XML_Char *base, >> 336 const XML_Char *systemId, >> 337 const XML_Char *publicId, >> 338 const XML_Char *notationName); 363 339 364 XMLPARSEAPI(void) 340 XMLPARSEAPI(void) 365 XML_SetEntityDeclHandler(XML_Parser parser, XM << 341 XML_SetEntityDeclHandler(XML_Parser parser, >> 342 XML_EntityDeclHandler handler); 366 343 367 /* OBSOLETE -- OBSOLETE -- OBSOLETE 344 /* OBSOLETE -- OBSOLETE -- OBSOLETE 368 This handler has been superseded by the Ent << 345 This handler has been superceded by the EntityDeclHandler above. 369 It is provided here for backward compatibil 346 It is provided here for backward compatibility. 370 347 371 This is called for a declaration of an unpa 348 This is called for a declaration of an unparsed (NDATA) entity. 372 The base argument is whatever was set by XM 349 The base argument is whatever was set by XML_SetBase. The 373 entityName, systemId and notationName argum 350 entityName, systemId and notationName arguments will never be 374 NULL. The other arguments may be. 351 NULL. The other arguments may be. 375 */ 352 */ 376 typedef void(XMLCALL *XML_UnparsedEntityDeclHa << 353 typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( 377 void *userData, const XML_Char *entityName << 354 void *userData, 378 const XML_Char *systemId, const XML_Char * << 355 const XML_Char *entityName, 379 const XML_Char *notationName); << 356 const XML_Char *base, >> 357 const XML_Char *systemId, >> 358 const XML_Char *publicId, >> 359 const XML_Char *notationName); 380 360 381 /* This is called for a declaration of notatio 361 /* This is called for a declaration of notation. The base argument is 382 whatever was set by XML_SetBase. The notati 362 whatever was set by XML_SetBase. The notationName will never be 383 NULL. The other arguments can be. 363 NULL. The other arguments can be. 384 */ 364 */ 385 typedef void(XMLCALL *XML_NotationDeclHandler) << 365 typedef void (XMLCALL *XML_NotationDeclHandler) ( 386 << 366 void *userData, 387 << 367 const XML_Char *notationName, 388 << 368 const XML_Char *base, 389 << 369 const XML_Char *systemId, >> 370 const XML_Char *publicId); 390 371 391 /* When namespace processing is enabled, these 372 /* When namespace processing is enabled, these are called once for 392 each namespace declaration. The call to the 373 each namespace declaration. The call to the start and end element 393 handlers occur between the calls to the sta 374 handlers occur between the calls to the start and end namespace 394 declaration handlers. For an xmlns attribut 375 declaration handlers. For an xmlns attribute, prefix will be 395 NULL. For an xmlns="" attribute, uri will 376 NULL. For an xmlns="" attribute, uri will be NULL. 396 */ 377 */ 397 typedef void(XMLCALL *XML_StartNamespaceDeclHa << 378 typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( 398 << 379 void *userData, 399 << 380 const XML_Char *prefix, 400 << 381 const XML_Char *uri); 401 typedef void(XMLCALL *XML_EndNamespaceDeclHand << 382 402 << 383 typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( >> 384 void *userData, >> 385 const XML_Char *prefix); 403 386 404 /* This is called if the document is not stand 387 /* This is called if the document is not standalone, that is, it has an 405 external subset or a reference to a paramet 388 external subset or a reference to a parameter entity, but does not 406 have standalone="yes". If this handler retu 389 have standalone="yes". If this handler returns XML_STATUS_ERROR, 407 then processing will not continue, and the 390 then processing will not continue, and the parser will return a 408 XML_ERROR_NOT_STANDALONE error. 391 XML_ERROR_NOT_STANDALONE error. 409 If parameter entity parsing is enabled, the 392 If parameter entity parsing is enabled, then in addition to the 410 conditions above this handler will only be 393 conditions above this handler will only be called if the referenced 411 entity was actually read. 394 entity was actually read. 412 */ 395 */ 413 typedef int(XMLCALL *XML_NotStandaloneHandler) << 396 typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); 414 397 415 /* This is called for a reference to an extern 398 /* This is called for a reference to an external parsed general 416 entity. The referenced entity is not autom 399 entity. The referenced entity is not automatically parsed. The 417 application can parse it immediately or lat 400 application can parse it immediately or later using 418 XML_ExternalEntityParserCreate. 401 XML_ExternalEntityParserCreate. 419 402 420 The parser argument is the parser parsing t 403 The parser argument is the parser parsing the entity containing the 421 reference; it can be passed as the parser a 404 reference; it can be passed as the parser argument to 422 XML_ExternalEntityParserCreate. The system 405 XML_ExternalEntityParserCreate. The systemId argument is the 423 system identifier as specified in the entit 406 system identifier as specified in the entity declaration; it will 424 not be NULL. 407 not be NULL. 425 408 426 The base argument is the system identifier 409 The base argument is the system identifier that should be used as 427 the base for resolving systemId if systemId 410 the base for resolving systemId if systemId was relative; this is 428 set by XML_SetBase; it may be NULL. 411 set by XML_SetBase; it may be NULL. 429 412 430 The publicId argument is the public identif 413 The publicId argument is the public identifier as specified in the 431 entity declaration, or NULL if none was spe 414 entity declaration, or NULL if none was specified; the whitespace 432 in the public identifier will have been nor 415 in the public identifier will have been normalized as required by 433 the XML spec. 416 the XML spec. 434 417 435 The context argument specifies the parsing 418 The context argument specifies the parsing context in the format 436 expected by the context argument to XML_Ext 419 expected by the context argument to XML_ExternalEntityParserCreate; 437 context is valid only until the handler ret 420 context is valid only until the handler returns, so if the 438 referenced entity is to be parsed later, it 421 referenced entity is to be parsed later, it must be copied. 439 context is NULL only when the entity is a p 422 context is NULL only when the entity is a parameter entity. 440 423 441 The handler should return XML_STATUS_ERROR 424 The handler should return XML_STATUS_ERROR if processing should not 442 continue because of a fatal error in the ha 425 continue because of a fatal error in the handling of the external 443 entity. In this case the calling parser wi 426 entity. In this case the calling parser will return an 444 XML_ERROR_EXTERNAL_ENTITY_HANDLING error. 427 XML_ERROR_EXTERNAL_ENTITY_HANDLING error. 445 428 446 Note that unlike other handlers the first a 429 Note that unlike other handlers the first argument is the parser, 447 not userData. 430 not userData. 448 */ 431 */ 449 typedef int(XMLCALL *XML_ExternalEntityRefHand << 432 typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( 450 << 433 XML_Parser parser, 451 << 434 const XML_Char *context, 452 << 435 const XML_Char *base, 453 << 436 const XML_Char *systemId, >> 437 const XML_Char *publicId); 454 438 455 /* This is called in two situations: 439 /* This is called in two situations: 456 1) An entity reference is encountered for w 440 1) An entity reference is encountered for which no declaration 457 has been read *and* this is not an error 441 has been read *and* this is not an error. 458 2) An internal entity reference is read, bu 442 2) An internal entity reference is read, but not expanded, because 459 XML_SetDefaultHandler has been called. 443 XML_SetDefaultHandler has been called. 460 Note: skipped parameter entities in declara 444 Note: skipped parameter entities in declarations and skipped general 461 entities in attribute values cannot b 445 entities in attribute values cannot be reported, because 462 the event would be out of sync with t 446 the event would be out of sync with the reporting of the 463 declarations or attribute values 447 declarations or attribute values 464 */ 448 */ 465 typedef void(XMLCALL *XML_SkippedEntityHandler << 449 typedef void (XMLCALL *XML_SkippedEntityHandler) ( 466 << 450 void *userData, 467 << 451 const XML_Char *entityName, >> 452 int is_parameter_entity); 468 453 469 /* This structure is filled in by the XML_Unkn 454 /* This structure is filled in by the XML_UnknownEncodingHandler to 470 provide information to the parser about enc 455 provide information to the parser about encodings that are unknown 471 to the parser. 456 to the parser. 472 457 473 The map[b] member gives information about b 458 The map[b] member gives information about byte sequences whose 474 first byte is b. 459 first byte is b. 475 460 476 If map[b] is c where c is >= 0, then b by i 461 If map[b] is c where c is >= 0, then b by itself encodes the 477 Unicode scalar value c. 462 Unicode scalar value c. 478 463 479 If map[b] is -1, then the byte sequence is 464 If map[b] is -1, then the byte sequence is malformed. 480 465 481 If map[b] is -n, where n >= 2, then b is th 466 If map[b] is -n, where n >= 2, then b is the first byte of an 482 n-byte sequence that encodes a single Unico 467 n-byte sequence that encodes a single Unicode scalar value. 483 468 484 The data member will be passed as the first 469 The data member will be passed as the first argument to the convert 485 function. 470 function. 486 471 487 The convert function is used to convert mul 472 The convert function is used to convert multibyte sequences; s will 488 point to a n-byte sequence where map[(unsig 473 point to a n-byte sequence where map[(unsigned char)*s] == -n. The 489 convert function must return the Unicode sc 474 convert function must return the Unicode scalar value represented 490 by this byte sequence or -1 if the byte seq 475 by this byte sequence or -1 if the byte sequence is malformed. 491 476 492 The convert function may be NULL if the enc 477 The convert function may be NULL if the encoding is a single-byte 493 encoding, that is if map[b] >= -1 for all b 478 encoding, that is if map[b] >= -1 for all bytes b. 494 479 495 When the parser is finished with the encodi 480 When the parser is finished with the encoding, then if release is 496 not NULL, it will call release passing it t 481 not NULL, it will call release passing it the data member; once 497 release has been called, the convert functi 482 release has been called, the convert function will not be called 498 again. 483 again. 499 484 500 Expat places certain restrictions on the en 485 Expat places certain restrictions on the encodings that are supported 501 using this mechanism. 486 using this mechanism. 502 487 503 1. Every ASCII character that can appear in 488 1. Every ASCII character that can appear in a well-formed XML document, 504 other than the characters 489 other than the characters 505 490 506 $@\^`{}~ 491 $@\^`{}~ 507 492 508 must be represented by a single byte, an 493 must be represented by a single byte, and that byte must be the 509 same byte that represents that character 494 same byte that represents that character in ASCII. 510 495 511 2. No character may require more than 4 byt 496 2. No character may require more than 4 bytes to encode. 512 497 513 3. All characters encoded must have Unicode 498 3. All characters encoded must have Unicode scalar values <= 514 0xFFFF, (i.e., characters that would be 499 0xFFFF, (i.e., characters that would be encoded by surrogates in 515 UTF-16 are not allowed). Note that thi 500 UTF-16 are not allowed). Note that this restriction doesn't 516 apply to the built-in support for UTF-8 501 apply to the built-in support for UTF-8 and UTF-16. 517 502 518 4. No Unicode character may be encoded by m 503 4. No Unicode character may be encoded by more than one distinct 519 sequence of bytes. 504 sequence of bytes. 520 */ 505 */ 521 typedef struct { 506 typedef struct { 522 int map[256]; 507 int map[256]; 523 void *data; 508 void *data; 524 int(XMLCALL *convert)(void *data, const char << 509 int (XMLCALL *convert)(void *data, const char *s); 525 void(XMLCALL *release)(void *data); << 510 void (XMLCALL *release)(void *data); 526 } XML_Encoding; 511 } XML_Encoding; 527 512 528 /* This is called for an encoding that is unkn 513 /* This is called for an encoding that is unknown to the parser. 529 514 530 The encodingHandlerData argument is that wh 515 The encodingHandlerData argument is that which was passed as the 531 second argument to XML_SetUnknownEncodingHa 516 second argument to XML_SetUnknownEncodingHandler. 532 517 533 The name argument gives the name of the enc 518 The name argument gives the name of the encoding as specified in 534 the encoding declaration. 519 the encoding declaration. 535 520 536 If the callback can provide information abo 521 If the callback can provide information about the encoding, it must 537 fill in the XML_Encoding structure, and ret 522 fill in the XML_Encoding structure, and return XML_STATUS_OK. 538 Otherwise it must return XML_STATUS_ERROR. 523 Otherwise it must return XML_STATUS_ERROR. 539 524 540 If info does not describe a suitable encodi 525 If info does not describe a suitable encoding, then the parser will 541 return an XML_ERROR_UNKNOWN_ENCODING error. << 526 return an XML_UNKNOWN_ENCODING error. 542 */ 527 */ 543 typedef int(XMLCALL *XML_UnknownEncodingHandle << 528 typedef int (XMLCALL *XML_UnknownEncodingHandler) ( 544 << 529 void *encodingHandlerData, 545 << 530 const XML_Char *name, >> 531 XML_Encoding *info); 546 532 547 XMLPARSEAPI(void) 533 XMLPARSEAPI(void) 548 XML_SetElementHandler(XML_Parser parser, XML_S << 534 XML_SetElementHandler(XML_Parser parser, >> 535 XML_StartElementHandler start, 549 XML_EndElementHandler en 536 XML_EndElementHandler end); 550 537 551 XMLPARSEAPI(void) 538 XMLPARSEAPI(void) 552 XML_SetStartElementHandler(XML_Parser parser, << 539 XML_SetStartElementHandler(XML_Parser parser, >> 540 XML_StartElementHandler handler); 553 541 554 XMLPARSEAPI(void) 542 XMLPARSEAPI(void) 555 XML_SetEndElementHandler(XML_Parser parser, XM << 543 XML_SetEndElementHandler(XML_Parser parser, >> 544 XML_EndElementHandler handler); 556 545 557 XMLPARSEAPI(void) 546 XMLPARSEAPI(void) 558 XML_SetCharacterDataHandler(XML_Parser parser, 547 XML_SetCharacterDataHandler(XML_Parser parser, 559 XML_CharacterDataH 548 XML_CharacterDataHandler handler); 560 549 561 XMLPARSEAPI(void) 550 XMLPARSEAPI(void) 562 XML_SetProcessingInstructionHandler(XML_Parser 551 XML_SetProcessingInstructionHandler(XML_Parser parser, 563 XML_Proces 552 XML_ProcessingInstructionHandler handler); 564 XMLPARSEAPI(void) 553 XMLPARSEAPI(void) 565 XML_SetCommentHandler(XML_Parser parser, XML_C << 554 XML_SetCommentHandler(XML_Parser parser, >> 555 XML_CommentHandler handler); 566 556 567 XMLPARSEAPI(void) 557 XMLPARSEAPI(void) 568 XML_SetCdataSectionHandler(XML_Parser parser, 558 XML_SetCdataSectionHandler(XML_Parser parser, 569 XML_StartCdataSecti 559 XML_StartCdataSectionHandler start, 570 XML_EndCdataSection 560 XML_EndCdataSectionHandler end); 571 561 572 XMLPARSEAPI(void) 562 XMLPARSEAPI(void) 573 XML_SetStartCdataSectionHandler(XML_Parser par 563 XML_SetStartCdataSectionHandler(XML_Parser parser, 574 XML_StartCdata 564 XML_StartCdataSectionHandler start); 575 565 576 XMLPARSEAPI(void) 566 XMLPARSEAPI(void) 577 XML_SetEndCdataSectionHandler(XML_Parser parse 567 XML_SetEndCdataSectionHandler(XML_Parser parser, 578 XML_EndCdataSect 568 XML_EndCdataSectionHandler end); 579 569 580 /* This sets the default handler and also inhi 570 /* This sets the default handler and also inhibits expansion of 581 internal entities. These entity references 571 internal entities. These entity references will be passed to the 582 default handler, or to the skipped entity h 572 default handler, or to the skipped entity handler, if one is set. 583 */ 573 */ 584 XMLPARSEAPI(void) 574 XMLPARSEAPI(void) 585 XML_SetDefaultHandler(XML_Parser parser, XML_D << 575 XML_SetDefaultHandler(XML_Parser parser, >> 576 XML_DefaultHandler handler); 586 577 587 /* This sets the default handler but does not 578 /* This sets the default handler but does not inhibit expansion of 588 internal entities. The entity reference wi 579 internal entities. The entity reference will not be passed to the 589 default handler. 580 default handler. 590 */ 581 */ 591 XMLPARSEAPI(void) 582 XMLPARSEAPI(void) 592 XML_SetDefaultHandlerExpand(XML_Parser parser, << 583 XML_SetDefaultHandlerExpand(XML_Parser parser, >> 584 XML_DefaultHandler handler); 593 585 594 XMLPARSEAPI(void) 586 XMLPARSEAPI(void) 595 XML_SetDoctypeDeclHandler(XML_Parser parser, X << 587 XML_SetDoctypeDeclHandler(XML_Parser parser, >> 588 XML_StartDoctypeDeclHandler start, 596 XML_EndDoctypeDeclHa 589 XML_EndDoctypeDeclHandler end); 597 590 598 XMLPARSEAPI(void) 591 XMLPARSEAPI(void) 599 XML_SetStartDoctypeDeclHandler(XML_Parser pars 592 XML_SetStartDoctypeDeclHandler(XML_Parser parser, 600 XML_StartDoctyp 593 XML_StartDoctypeDeclHandler start); 601 594 602 XMLPARSEAPI(void) 595 XMLPARSEAPI(void) 603 XML_SetEndDoctypeDeclHandler(XML_Parser parser << 596 XML_SetEndDoctypeDeclHandler(XML_Parser parser, >> 597 XML_EndDoctypeDeclHandler end); 604 598 605 XMLPARSEAPI(void) 599 XMLPARSEAPI(void) 606 XML_SetUnparsedEntityDeclHandler(XML_Parser pa 600 XML_SetUnparsedEntityDeclHandler(XML_Parser parser, 607 XML_UnparsedE 601 XML_UnparsedEntityDeclHandler handler); 608 602 609 XMLPARSEAPI(void) 603 XMLPARSEAPI(void) 610 XML_SetNotationDeclHandler(XML_Parser parser, << 604 XML_SetNotationDeclHandler(XML_Parser parser, >> 605 XML_NotationDeclHandler handler); 611 606 612 XMLPARSEAPI(void) 607 XMLPARSEAPI(void) 613 XML_SetNamespaceDeclHandler(XML_Parser parser, 608 XML_SetNamespaceDeclHandler(XML_Parser parser, 614 XML_StartNamespace 609 XML_StartNamespaceDeclHandler start, 615 XML_EndNamespaceDe 610 XML_EndNamespaceDeclHandler end); 616 611 617 XMLPARSEAPI(void) 612 XMLPARSEAPI(void) 618 XML_SetStartNamespaceDeclHandler(XML_Parser pa 613 XML_SetStartNamespaceDeclHandler(XML_Parser parser, 619 XML_StartName 614 XML_StartNamespaceDeclHandler start); 620 615 621 XMLPARSEAPI(void) 616 XMLPARSEAPI(void) 622 XML_SetEndNamespaceDeclHandler(XML_Parser pars 617 XML_SetEndNamespaceDeclHandler(XML_Parser parser, 623 XML_EndNamespac 618 XML_EndNamespaceDeclHandler end); 624 619 625 XMLPARSEAPI(void) 620 XMLPARSEAPI(void) 626 XML_SetNotStandaloneHandler(XML_Parser parser, 621 XML_SetNotStandaloneHandler(XML_Parser parser, 627 XML_NotStandaloneH 622 XML_NotStandaloneHandler handler); 628 623 629 XMLPARSEAPI(void) 624 XMLPARSEAPI(void) 630 XML_SetExternalEntityRefHandler(XML_Parser par 625 XML_SetExternalEntityRefHandler(XML_Parser parser, 631 XML_ExternalEn 626 XML_ExternalEntityRefHandler handler); 632 627 633 /* If a non-NULL value for arg is specified he 628 /* If a non-NULL value for arg is specified here, then it will be 634 passed as the first argument to the externa 629 passed as the first argument to the external entity ref handler 635 instead of the parser object. 630 instead of the parser object. 636 */ 631 */ 637 XMLPARSEAPI(void) 632 XMLPARSEAPI(void) 638 XML_SetExternalEntityRefHandlerArg(XML_Parser << 633 XML_SetExternalEntityRefHandlerArg(XML_Parser parser, >> 634 void *arg); 639 635 640 XMLPARSEAPI(void) 636 XMLPARSEAPI(void) 641 XML_SetSkippedEntityHandler(XML_Parser parser, 637 XML_SetSkippedEntityHandler(XML_Parser parser, 642 XML_SkippedEntityH 638 XML_SkippedEntityHandler handler); 643 639 644 XMLPARSEAPI(void) 640 XMLPARSEAPI(void) 645 XML_SetUnknownEncodingHandler(XML_Parser parse 641 XML_SetUnknownEncodingHandler(XML_Parser parser, 646 XML_UnknownEncod 642 XML_UnknownEncodingHandler handler, 647 void *encodingHa 643 void *encodingHandlerData); 648 644 649 /* This can be called within a handler for a s 645 /* This can be called within a handler for a start element, end 650 element, processing instruction or characte 646 element, processing instruction or character data. It causes the 651 corresponding markup to be passed to the de 647 corresponding markup to be passed to the default handler. 652 */ 648 */ 653 XMLPARSEAPI(void) 649 XMLPARSEAPI(void) 654 XML_DefaultCurrent(XML_Parser parser); 650 XML_DefaultCurrent(XML_Parser parser); 655 651 656 /* If do_nst is non-zero, and namespace proces 652 /* If do_nst is non-zero, and namespace processing is in effect, and 657 a name has a prefix (i.e. an explicit names 653 a name has a prefix (i.e. an explicit namespace qualifier) then 658 that name is returned as a triplet in a sin 654 that name is returned as a triplet in a single string separated by 659 the separator character specified when the 655 the separator character specified when the parser was created: URI 660 + sep + local_name + sep + prefix. 656 + sep + local_name + sep + prefix. 661 657 662 If do_nst is zero, then namespace informati 658 If do_nst is zero, then namespace information is returned in the 663 default manner (URI + sep + local_name) whe 659 default manner (URI + sep + local_name) whether or not the name 664 has a prefix. 660 has a prefix. 665 661 666 Note: Calling XML_SetReturnNSTriplet after 662 Note: Calling XML_SetReturnNSTriplet after XML_Parse or 667 XML_ParseBuffer has no effect. 663 XML_ParseBuffer has no effect. 668 */ 664 */ 669 665 670 XMLPARSEAPI(void) 666 XMLPARSEAPI(void) 671 XML_SetReturnNSTriplet(XML_Parser parser, int 667 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); 672 668 673 /* This value is passed as the userData argume 669 /* This value is passed as the userData argument to callbacks. */ 674 XMLPARSEAPI(void) 670 XMLPARSEAPI(void) 675 XML_SetUserData(XML_Parser parser, void *userD 671 XML_SetUserData(XML_Parser parser, void *userData); 676 672 677 /* Returns the last value set by XML_SetUserDa 673 /* Returns the last value set by XML_SetUserData or NULL. */ 678 #define XML_GetUserData(parser) (*(void **)(pa 674 #define XML_GetUserData(parser) (*(void **)(parser)) 679 675 680 /* This is equivalent to supplying an encoding 676 /* This is equivalent to supplying an encoding argument to 681 XML_ParserCreate. On success XML_SetEncodin 677 XML_ParserCreate. On success XML_SetEncoding returns non-zero, 682 zero otherwise. 678 zero otherwise. 683 Note: Calling XML_SetEncoding after XML_Par 679 Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer 684 has no effect and returns XML_STATUS_ERRO 680 has no effect and returns XML_STATUS_ERROR. 685 */ 681 */ 686 XMLPARSEAPI(enum XML_Status) 682 XMLPARSEAPI(enum XML_Status) 687 XML_SetEncoding(XML_Parser parser, const XML_C 683 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); 688 684 689 /* If this function is called, then the parser 685 /* If this function is called, then the parser will be passed as the 690 first argument to callbacks instead of user 686 first argument to callbacks instead of userData. The userData will 691 still be accessible using XML_GetUserData. 687 still be accessible using XML_GetUserData. 692 */ 688 */ 693 XMLPARSEAPI(void) 689 XMLPARSEAPI(void) 694 XML_UseParserAsHandlerArg(XML_Parser parser); 690 XML_UseParserAsHandlerArg(XML_Parser parser); 695 691 696 /* If useDTD == XML_TRUE is passed to this fun 692 /* If useDTD == XML_TRUE is passed to this function, then the parser 697 will assume that there is an external subse 693 will assume that there is an external subset, even if none is 698 specified in the document. In such a case t 694 specified in the document. In such a case the parser will call the 699 externalEntityRefHandler with a value of NU 695 externalEntityRefHandler with a value of NULL for the systemId 700 argument (the publicId and context argument 696 argument (the publicId and context arguments will be NULL as well). 701 Note: For the purpose of checking WFC: Enti 697 Note: For the purpose of checking WFC: Entity Declared, passing 702 useDTD == XML_TRUE will make the parser b 698 useDTD == XML_TRUE will make the parser behave as if the document 703 had a DTD with an external subset. 699 had a DTD with an external subset. 704 Note: If this function is called, then this 700 Note: If this function is called, then this must be done before 705 the first call to XML_Parse or XML_ParseB 701 the first call to XML_Parse or XML_ParseBuffer, since it will 706 have no effect after that. Returns 702 have no effect after that. Returns 707 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSIN 703 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. 708 Note: If the document does not have a DOCTY 704 Note: If the document does not have a DOCTYPE declaration at all, 709 then startDoctypeDeclHandler and endDocty 705 then startDoctypeDeclHandler and endDoctypeDeclHandler will not 710 be called, despite an external subset bei 706 be called, despite an external subset being parsed. 711 Note: If XML_DTD is not defined when Expat 707 Note: If XML_DTD is not defined when Expat is compiled, returns 712 XML_ERROR_FEATURE_REQUIRES_XML_DTD. 708 XML_ERROR_FEATURE_REQUIRES_XML_DTD. 713 Note: If parser == NULL, returns XML_ERROR_ << 714 */ 709 */ 715 XMLPARSEAPI(enum XML_Error) 710 XMLPARSEAPI(enum XML_Error) 716 XML_UseForeignDTD(XML_Parser parser, XML_Bool 711 XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); 717 712 >> 713 718 /* Sets the base to be used for resolving rela 714 /* Sets the base to be used for resolving relative URIs in system 719 identifiers in declarations. Resolving rel 715 identifiers in declarations. Resolving relative identifiers is 720 left to the application: this value will be 716 left to the application: this value will be passed through as the 721 base argument to the XML_ExternalEntityRefH 717 base argument to the XML_ExternalEntityRefHandler, 722 XML_NotationDeclHandler and XML_UnparsedEnt 718 XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base 723 argument will be copied. Returns XML_STATU 719 argument will be copied. Returns XML_STATUS_ERROR if out of memory, 724 XML_STATUS_OK otherwise. 720 XML_STATUS_OK otherwise. 725 */ 721 */ 726 XMLPARSEAPI(enum XML_Status) 722 XMLPARSEAPI(enum XML_Status) 727 XML_SetBase(XML_Parser parser, const XML_Char 723 XML_SetBase(XML_Parser parser, const XML_Char *base); 728 724 729 XMLPARSEAPI(const XML_Char *) 725 XMLPARSEAPI(const XML_Char *) 730 XML_GetBase(XML_Parser parser); 726 XML_GetBase(XML_Parser parser); 731 727 732 /* Returns the number of the attribute/value p 728 /* Returns the number of the attribute/value pairs passed in last call 733 to the XML_StartElementHandler that were sp 729 to the XML_StartElementHandler that were specified in the start-tag 734 rather than defaulted. Each attribute/value 730 rather than defaulted. Each attribute/value pair counts as 2; thus 735 this corresponds to an index into the atts << 731 this correspondds to an index into the atts array passed to the 736 XML_StartElementHandler. Returns -1 if par << 732 XML_StartElementHandler. 737 */ 733 */ 738 XMLPARSEAPI(int) 734 XMLPARSEAPI(int) 739 XML_GetSpecifiedAttributeCount(XML_Parser pars 735 XML_GetSpecifiedAttributeCount(XML_Parser parser); 740 736 741 /* Returns the index of the ID attribute passe 737 /* Returns the index of the ID attribute passed in the last call to 742 XML_StartElementHandler, or -1 if there is << 738 XML_StartElementHandler, or -1 if there is no ID attribute. Each 743 parser == NULL. Each attribute/value pair << 739 attribute/value pair counts as 2; thus this correspondds to an 744 corresponds to an index into the atts array << 740 index into the atts array passed to the XML_StartElementHandler. 745 XML_StartElementHandler. << 746 */ 741 */ 747 XMLPARSEAPI(int) 742 XMLPARSEAPI(int) 748 XML_GetIdAttributeIndex(XML_Parser parser); 743 XML_GetIdAttributeIndex(XML_Parser parser); 749 744 750 #ifdef XML_ATTR_INFO 745 #ifdef XML_ATTR_INFO 751 /* Source file byte offsets for the start and 746 /* Source file byte offsets for the start and end of attribute names and values. 752 The value indices are exclusive of surround 747 The value indices are exclusive of surrounding quotes; thus in a UTF-8 source 753 file an attribute value of "blah" will yiel 748 file an attribute value of "blah" will yield: 754 info->valueEnd - info->valueStart = 4 bytes 749 info->valueEnd - info->valueStart = 4 bytes. 755 */ 750 */ 756 typedef struct { 751 typedef struct { 757 XML_Index nameStart; /* Offset to beginning << 752 XML_Index nameStart; /* Offset to beginning of the attribute name. */ 758 XML_Index nameEnd; /* Offset after the at << 753 XML_Index nameEnd; /* Offset after the attribute name's last byte. */ 759 XML_Index valueStart; /* Offset to beginning << 754 XML_Index valueStart; /* Offset to beginning of the attribute value. */ 760 XML_Index valueEnd; /* Offset after the at << 755 XML_Index valueEnd; /* Offset after the attribute value's last byte. */ 761 } XML_AttrInfo; 756 } XML_AttrInfo; 762 757 763 /* Returns an array of XML_AttrInfo structures 758 /* Returns an array of XML_AttrInfo structures for the attribute/value pairs 764 passed in last call to the XML_StartElement 759 passed in last call to the XML_StartElementHandler that were specified 765 in the start-tag rather than defaulted. Eac 760 in the start-tag rather than defaulted. Each attribute/value pair counts 766 as 1; thus the number of entries in the arr 761 as 1; thus the number of entries in the array is 767 XML_GetSpecifiedAttributeCount(parser) / 2. 762 XML_GetSpecifiedAttributeCount(parser) / 2. 768 */ 763 */ 769 XMLPARSEAPI(const XML_AttrInfo *) 764 XMLPARSEAPI(const XML_AttrInfo *) 770 XML_GetAttributeInfo(XML_Parser parser); 765 XML_GetAttributeInfo(XML_Parser parser); 771 #endif 766 #endif 772 767 773 /* Parses some input. Returns XML_STATUS_ERROR 768 /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is 774 detected. The last call to XML_Parse must 769 detected. The last call to XML_Parse must have isFinal true; len 775 may be zero for this call (or any other). 770 may be zero for this call (or any other). 776 771 777 Though the return values for these function 772 Though the return values for these functions has always been 778 described as a Boolean value, the implement 773 described as a Boolean value, the implementation, at least for the 779 1.95.x series, has always returned exactly 774 1.95.x series, has always returned exactly one of the XML_Status 780 values. 775 values. 781 */ 776 */ 782 XMLPARSEAPI(enum XML_Status) 777 XMLPARSEAPI(enum XML_Status) 783 XML_Parse(XML_Parser parser, const char *s, in 778 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); 784 779 785 XMLPARSEAPI(void *) 780 XMLPARSEAPI(void *) 786 XML_GetBuffer(XML_Parser parser, int len); 781 XML_GetBuffer(XML_Parser parser, int len); 787 782 788 XMLPARSEAPI(enum XML_Status) 783 XMLPARSEAPI(enum XML_Status) 789 XML_ParseBuffer(XML_Parser parser, int len, in 784 XML_ParseBuffer(XML_Parser parser, int len, int isFinal); 790 785 791 /* Stops parsing, causing XML_Parse() or XML_P 786 /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. 792 Must be called from within a call-back hand 787 Must be called from within a call-back handler, except when aborting 793 (resumable = 0) an already suspended parser 788 (resumable = 0) an already suspended parser. Some call-backs may 794 still follow because they would otherwise g 789 still follow because they would otherwise get lost. Examples: 795 - endElementHandler() for empty elements wh 790 - endElementHandler() for empty elements when stopped in 796 startElementHandler(), << 791 startElementHandler(), 797 - endNameSpaceDeclHandler() when stopped in << 792 - endNameSpaceDeclHandler() when stopped in endElementHandler(), 798 and possibly others. 793 and possibly others. 799 794 800 Can be called from most handlers, including 795 Can be called from most handlers, including DTD related call-backs, 801 except when parsing an external parameter e 796 except when parsing an external parameter entity and resumable != 0. 802 Returns XML_STATUS_OK when successful, XML_ 797 Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. 803 Possible error codes: << 798 Possible error codes: 804 - XML_ERROR_SUSPENDED: when suspending an a 799 - XML_ERROR_SUSPENDED: when suspending an already suspended parser. 805 - XML_ERROR_FINISHED: when the parser has a 800 - XML_ERROR_FINISHED: when the parser has already finished. 806 - XML_ERROR_SUSPEND_PE: when suspending whi 801 - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. 807 802 808 When resumable != 0 (true) then parsing is << 803 When resumable != 0 (true) then parsing is suspended, that is, 809 XML_Parse() and XML_ParseBuffer() return XM << 804 XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. 810 Otherwise, parsing is aborted, that is, XML 805 Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() 811 return XML_STATUS_ERROR with error code XML 806 return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. 812 807 813 *Note*: 808 *Note*: 814 This will be applied to the current parser 809 This will be applied to the current parser instance only, that is, if 815 there is a parent parser then it will conti 810 there is a parent parser then it will continue parsing when the 816 externalEntityRefHandler() returns. It is u 811 externalEntityRefHandler() returns. It is up to the implementation of 817 the externalEntityRefHandler() to call XML_ 812 the externalEntityRefHandler() to call XML_StopParser() on the parent 818 parser (recursively), if one wants to stop 813 parser (recursively), if one wants to stop parsing altogether. 819 814 820 When suspended, parsing can be resumed by c << 815 When suspended, parsing can be resumed by calling XML_ResumeParser(). 821 */ 816 */ 822 XMLPARSEAPI(enum XML_Status) 817 XMLPARSEAPI(enum XML_Status) 823 XML_StopParser(XML_Parser parser, XML_Bool res 818 XML_StopParser(XML_Parser parser, XML_Bool resumable); 824 819 825 /* Resumes parsing after it has been suspended 820 /* Resumes parsing after it has been suspended with XML_StopParser(). 826 Must not be called from within a handler ca 821 Must not be called from within a handler call-back. Returns same 827 status codes as XML_Parse() or XML_ParseBuf 822 status codes as XML_Parse() or XML_ParseBuffer(). 828 Additional error code XML_ERROR_NOT_SUSPEND << 823 Additional error code XML_ERROR_NOT_SUSPENDED possible. 829 824 830 *Note*: 825 *Note*: 831 This must be called on the most deeply nest 826 This must be called on the most deeply nested child parser instance 832 first, and on its parent parser only after 827 first, and on its parent parser only after the child parser has finished, 833 to be applied recursively until the documen 828 to be applied recursively until the document entity's parser is restarted. 834 That is, the parent parser will not resume 829 That is, the parent parser will not resume by itself and it is up to the 835 application to call XML_ResumeParser() on i 830 application to call XML_ResumeParser() on it at the appropriate moment. 836 */ 831 */ 837 XMLPARSEAPI(enum XML_Status) 832 XMLPARSEAPI(enum XML_Status) 838 XML_ResumeParser(XML_Parser parser); 833 XML_ResumeParser(XML_Parser parser); 839 834 840 enum XML_Parsing { XML_INITIALIZED, XML_PARSIN << 835 enum XML_Parsing { >> 836 XML_INITIALIZED, >> 837 XML_PARSING, >> 838 XML_FINISHED, >> 839 XML_SUSPENDED >> 840 }; 841 841 842 typedef struct { 842 typedef struct { 843 enum XML_Parsing parsing; 843 enum XML_Parsing parsing; 844 XML_Bool finalBuffer; 844 XML_Bool finalBuffer; 845 } XML_ParsingStatus; 845 } XML_ParsingStatus; 846 846 847 /* Returns status of parser with respect to be 847 /* Returns status of parser with respect to being initialized, parsing, 848 finished, or suspended and processing the f 848 finished, or suspended and processing the final buffer. 849 XXX XML_Parse() and XML_ParseBuffer() shoul 849 XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, 850 XXX with XML_FINISHED_OK or XML_FINISHED_ER 850 XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED 851 */ 851 */ 852 XMLPARSEAPI(void) 852 XMLPARSEAPI(void) 853 XML_GetParsingStatus(XML_Parser parser, XML_Pa 853 XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); 854 854 855 /* Creates an XML_Parser object that can parse 855 /* Creates an XML_Parser object that can parse an external general 856 entity; context is a '\0'-terminated string 856 entity; context is a '\0'-terminated string specifying the parse 857 context; encoding is a '\0'-terminated stri 857 context; encoding is a '\0'-terminated string giving the name of 858 the externally specified encoding, or NULL 858 the externally specified encoding, or NULL if there is no 859 externally specified encoding. The context 859 externally specified encoding. The context string consists of a 860 sequence of tokens separated by formfeeds ( 860 sequence of tokens separated by formfeeds (\f); a token consisting 861 of a name specifies that the general entity 861 of a name specifies that the general entity of the name is open; a 862 token of the form prefix=uri specifies the 862 token of the form prefix=uri specifies the namespace for a 863 particular prefix; a token of the form =uri 863 particular prefix; a token of the form =uri specifies the default 864 namespace. This can be called at any point 864 namespace. This can be called at any point after the first call to 865 an ExternalEntityRefHandler so longer as th 865 an ExternalEntityRefHandler so longer as the parser has not yet 866 been freed. The new parser is completely i 866 been freed. The new parser is completely independent and may 867 safely be used in a separate thread. The h 867 safely be used in a separate thread. The handlers and userData are 868 initialized from the parser argument. Retu 868 initialized from the parser argument. Returns NULL if out of memory. 869 Otherwise returns a new XML_Parser object. 869 Otherwise returns a new XML_Parser object. 870 */ 870 */ 871 XMLPARSEAPI(XML_Parser) 871 XMLPARSEAPI(XML_Parser) 872 XML_ExternalEntityParserCreate(XML_Parser pars << 872 XML_ExternalEntityParserCreate(XML_Parser parser, >> 873 const XML_Char *context, 873 const XML_Char 874 const XML_Char *encoding); 874 875 875 enum XML_ParamEntityParsing { 876 enum XML_ParamEntityParsing { 876 XML_PARAM_ENTITY_PARSING_NEVER, 877 XML_PARAM_ENTITY_PARSING_NEVER, 877 XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, 878 XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, 878 XML_PARAM_ENTITY_PARSING_ALWAYS 879 XML_PARAM_ENTITY_PARSING_ALWAYS 879 }; 880 }; 880 881 881 /* Controls parsing of parameter entities (inc 882 /* Controls parsing of parameter entities (including the external DTD 882 subset). If parsing of parameter entities i 883 subset). If parsing of parameter entities is enabled, then 883 references to external parameter entities ( 884 references to external parameter entities (including the external 884 DTD subset) will be passed to the handler s 885 DTD subset) will be passed to the handler set with 885 XML_SetExternalEntityRefHandler. The conte 886 XML_SetExternalEntityRefHandler. The context passed will be 0. 886 887 887 Unlike external general entities, external 888 Unlike external general entities, external parameter entities can 888 only be parsed synchronously. If the exter 889 only be parsed synchronously. If the external parameter entity is 889 to be parsed, it must be parsed during the 890 to be parsed, it must be parsed during the call to the external 890 entity ref handler: the complete sequence o 891 entity ref handler: the complete sequence of 891 XML_ExternalEntityParserCreate, XML_Parse/X 892 XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and 892 XML_ParserFree calls must be made during th 893 XML_ParserFree calls must be made during this call. After 893 XML_ExternalEntityParserCreate has been cal 894 XML_ExternalEntityParserCreate has been called to create the parser 894 for the external parameter entity (context 895 for the external parameter entity (context must be 0 for this 895 call), it is illegal to make any calls on t 896 call), it is illegal to make any calls on the old parser until 896 XML_ParserFree has been called on the newly 897 XML_ParserFree has been called on the newly created parser. 897 If the library has been compiled without su 898 If the library has been compiled without support for parameter 898 entity parsing (ie without XML_DTD being de 899 entity parsing (ie without XML_DTD being defined), then 899 XML_SetParamEntityParsing will return 0 if 900 XML_SetParamEntityParsing will return 0 if parsing of parameter 900 entities is requested; otherwise it will re 901 entities is requested; otherwise it will return non-zero. 901 Note: If XML_SetParamEntityParsing is calle 902 Note: If XML_SetParamEntityParsing is called after XML_Parse or 902 XML_ParseBuffer, then it has no effect a 903 XML_ParseBuffer, then it has no effect and will always return 0. 903 Note: If parser == NULL, the function will << 904 */ 904 */ 905 XMLPARSEAPI(int) 905 XMLPARSEAPI(int) 906 XML_SetParamEntityParsing(XML_Parser parser, 906 XML_SetParamEntityParsing(XML_Parser parser, 907 enum XML_ParamEntity 907 enum XML_ParamEntityParsing parsing); 908 908 909 /* Sets the hash salt to use for internal hash 909 /* Sets the hash salt to use for internal hash calculations. 910 Helps in preventing DoS attacks based on pr 910 Helps in preventing DoS attacks based on predicting hash 911 function behavior. This must be called befo 911 function behavior. This must be called before parsing is started. 912 Returns 1 if successful, 0 when called afte 912 Returns 1 if successful, 0 when called after parsing has started. 913 Note: If parser == NULL, the function will << 914 */ 913 */ 915 XMLPARSEAPI(int) 914 XMLPARSEAPI(int) 916 XML_SetHashSalt(XML_Parser parser, unsigned lo << 915 XML_SetHashSalt(XML_Parser parser, >> 916 unsigned long hash_salt); 917 917 918 /* If XML_Parse or XML_ParseBuffer have return 918 /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then 919 XML_GetErrorCode returns information about 919 XML_GetErrorCode returns information about the error. 920 */ 920 */ 921 XMLPARSEAPI(enum XML_Error) 921 XMLPARSEAPI(enum XML_Error) 922 XML_GetErrorCode(XML_Parser parser); 922 XML_GetErrorCode(XML_Parser parser); 923 923 924 /* These functions return information about th 924 /* These functions return information about the current parse 925 location. They may be called from any call 925 location. They may be called from any callback called to report 926 some parse event; in this case the location 926 some parse event; in this case the location is the location of the 927 first of the sequence of characters that ge 927 first of the sequence of characters that generated the event. When 928 called from callbacks generated by declarat 928 called from callbacks generated by declarations in the document 929 prologue, the location identified isn't as 929 prologue, the location identified isn't as neatly defined, but will 930 be within the relevant markup. When called 930 be within the relevant markup. When called outside of the callback 931 functions, the position indicated will be j 931 functions, the position indicated will be just past the last parse 932 event (regardless of whether there was an a 932 event (regardless of whether there was an associated callback). 933 << 933 934 They may also be called after returning fro 934 They may also be called after returning from a call to XML_Parse 935 or XML_ParseBuffer. If the return value is 935 or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then 936 the location is the location of the charact 936 the location is the location of the character at which the error 937 was detected; otherwise the location is the 937 was detected; otherwise the location is the location of the last 938 parse event, as described above. 938 parse event, as described above. 939 << 940 Note: XML_GetCurrentLineNumber and XML_GetC << 941 return 0 to indicate an error. << 942 Note: XML_GetCurrentByteIndex returns -1 to << 943 */ 939 */ 944 XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber 940 XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); 945 XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumb 941 XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); 946 XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex 942 XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); 947 943 948 /* Return the number of bytes in the current e 944 /* Return the number of bytes in the current event. 949 Returns 0 if the event is in an internal en 945 Returns 0 if the event is in an internal entity. 950 */ 946 */ 951 XMLPARSEAPI(int) 947 XMLPARSEAPI(int) 952 XML_GetCurrentByteCount(XML_Parser parser); 948 XML_GetCurrentByteCount(XML_Parser parser); 953 949 954 /* If XML_CONTEXT_BYTES is defined, returns th 950 /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets 955 the integer pointed to by offset to the off 951 the integer pointed to by offset to the offset within this buffer 956 of the current parse position, and sets the 952 of the current parse position, and sets the integer pointed to by size 957 to the size of this buffer (the number of i 953 to the size of this buffer (the number of input bytes). Otherwise 958 returns a NULL pointer. Also returns a NULL 954 returns a NULL pointer. Also returns a NULL pointer if a parse isn't 959 active. 955 active. 960 956 961 NOTE: The character pointer returned should 957 NOTE: The character pointer returned should not be used outside 962 the handler that makes the call. 958 the handler that makes the call. 963 */ 959 */ 964 XMLPARSEAPI(const char *) 960 XMLPARSEAPI(const char *) 965 XML_GetInputContext(XML_Parser parser, int *of << 961 XML_GetInputContext(XML_Parser parser, >> 962 int *offset, >> 963 int *size); 966 964 967 /* For backwards compatibility with previous v 965 /* For backwards compatibility with previous versions. */ 968 #define XML_GetErrorLineNumber XML_GetCurrentL << 966 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber 969 #define XML_GetErrorColumnNumber XML_GetCurren 967 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber 970 #define XML_GetErrorByteIndex XML_GetCurrentBy << 968 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex 971 969 972 /* Frees the content model passed to the eleme 970 /* Frees the content model passed to the element declaration handler */ 973 XMLPARSEAPI(void) 971 XMLPARSEAPI(void) 974 XML_FreeContentModel(XML_Parser parser, XML_Co 972 XML_FreeContentModel(XML_Parser parser, XML_Content *model); 975 973 976 /* Exposing the memory handling functions used 974 /* Exposing the memory handling functions used in Expat */ 977 XMLPARSEAPI(void *) 975 XMLPARSEAPI(void *) 978 XML_ATTR_MALLOC << 979 XML_ATTR_ALLOC_SIZE(2) << 980 XML_MemMalloc(XML_Parser parser, size_t size); 976 XML_MemMalloc(XML_Parser parser, size_t size); 981 977 982 XMLPARSEAPI(void *) 978 XMLPARSEAPI(void *) 983 XML_ATTR_ALLOC_SIZE(3) << 984 XML_MemRealloc(XML_Parser parser, void *ptr, s 979 XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); 985 980 986 XMLPARSEAPI(void) 981 XMLPARSEAPI(void) 987 XML_MemFree(XML_Parser parser, void *ptr); 982 XML_MemFree(XML_Parser parser, void *ptr); 988 983 989 /* Frees memory used by the parser. */ 984 /* Frees memory used by the parser. */ 990 XMLPARSEAPI(void) 985 XMLPARSEAPI(void) 991 XML_ParserFree(XML_Parser parser); 986 XML_ParserFree(XML_Parser parser); 992 987 993 /* Returns a string describing the error. */ 988 /* Returns a string describing the error. */ 994 XMLPARSEAPI(const XML_LChar *) 989 XMLPARSEAPI(const XML_LChar *) 995 XML_ErrorString(enum XML_Error code); 990 XML_ErrorString(enum XML_Error code); 996 991 997 /* Return a string containing the version numb 992 /* Return a string containing the version number of this expat */ 998 XMLPARSEAPI(const XML_LChar *) 993 XMLPARSEAPI(const XML_LChar *) 999 XML_ExpatVersion(void); 994 XML_ExpatVersion(void); 1000 995 1001 typedef struct { 996 typedef struct { 1002 int major; 997 int major; 1003 int minor; 998 int minor; 1004 int micro; 999 int micro; 1005 } XML_Expat_Version; 1000 } XML_Expat_Version; 1006 1001 1007 /* Return an XML_Expat_Version structure cont 1002 /* Return an XML_Expat_Version structure containing numeric version 1008 number information for this version of exp 1003 number information for this version of expat. 1009 */ 1004 */ 1010 XMLPARSEAPI(XML_Expat_Version) 1005 XMLPARSEAPI(XML_Expat_Version) 1011 XML_ExpatVersionInfo(void); 1006 XML_ExpatVersionInfo(void); 1012 1007 1013 /* Added in Expat 1.95.5. */ 1008 /* Added in Expat 1.95.5. */ 1014 enum XML_FeatureEnum { 1009 enum XML_FeatureEnum { 1015 XML_FEATURE_END = 0, 1010 XML_FEATURE_END = 0, 1016 XML_FEATURE_UNICODE, 1011 XML_FEATURE_UNICODE, 1017 XML_FEATURE_UNICODE_WCHAR_T, 1012 XML_FEATURE_UNICODE_WCHAR_T, 1018 XML_FEATURE_DTD, 1013 XML_FEATURE_DTD, 1019 XML_FEATURE_CONTEXT_BYTES, 1014 XML_FEATURE_CONTEXT_BYTES, 1020 XML_FEATURE_MIN_SIZE, 1015 XML_FEATURE_MIN_SIZE, 1021 XML_FEATURE_SIZEOF_XML_CHAR, 1016 XML_FEATURE_SIZEOF_XML_CHAR, 1022 XML_FEATURE_SIZEOF_XML_LCHAR, 1017 XML_FEATURE_SIZEOF_XML_LCHAR, 1023 XML_FEATURE_NS, 1018 XML_FEATURE_NS, 1024 XML_FEATURE_LARGE_SIZE, 1019 XML_FEATURE_LARGE_SIZE, 1025 XML_FEATURE_ATTR_INFO, << 1020 XML_FEATURE_ATTR_INFO 1026 /* Added in Expat 2.4.0. */ << 1027 XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTIO << 1028 XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTIO << 1029 /* Additional features must be added to the 1021 /* Additional features must be added to the end of this enum. */ 1030 }; 1022 }; 1031 1023 1032 typedef struct { 1024 typedef struct { 1033 enum XML_FeatureEnum feature; << 1025 enum XML_FeatureEnum feature; 1034 const XML_LChar *name; << 1026 const XML_LChar *name; 1035 long int value; << 1027 long int value; 1036 } XML_Feature; 1028 } XML_Feature; 1037 1029 1038 XMLPARSEAPI(const XML_Feature *) 1030 XMLPARSEAPI(const XML_Feature *) 1039 XML_GetFeatureList(void); 1031 XML_GetFeatureList(void); 1040 1032 1041 #ifdef XML_DTD << 1042 /* Added in Expat 2.4.0. */ << 1043 XMLPARSEAPI(XML_Bool) << 1044 XML_SetBillionLaughsAttackProtectionMaximumAm << 1045 XML_Parser parser, float maximumAmplifica << 1046 << 1047 /* Added in Expat 2.4.0. */ << 1048 XMLPARSEAPI(XML_Bool) << 1049 XML_SetBillionLaughsAttackProtectionActivatio << 1050 XML_Parser parser, unsigned long long act << 1051 #endif << 1052 1033 1053 /* Expat follows the semantic versioning conv << 1034 /* Expat follows the GNU/Linux convention of odd number minor version for 1054 See http://semver.org. << 1035 beta/development releases and even number minor version for stable >> 1036 releases. Micro is bumped with each release, and set to 0 with each >> 1037 change to major or minor version. 1055 */ 1038 */ 1056 #define XML_MAJOR_VERSION 2 1039 #define XML_MAJOR_VERSION 2 1057 #define XML_MINOR_VERSION 4 << 1040 #define XML_MINOR_VERSION 1 1058 #define XML_MICRO_VERSION 9 << 1041 #define XML_MICRO_VERSION 0 1059 1042 1060 #ifdef __cplusplus 1043 #ifdef __cplusplus 1061 } 1044 } 1062 #endif 1045 #endif 1063 1046 1064 #endif /* not Expat_INCLUDED */ 1047 #endif /* not Expat_INCLUDED */ 1065 1048