expat.h (104349) | expat.h (178848) |
---|---|
1/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd 2 See the file COPYING for copying permission. 3*/ 4 | 1/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd 2 See the file COPYING for copying permission. 3*/ 4 |
5#ifndef XmlParse_INCLUDED 6#define XmlParse_INCLUDED 1 | 5#ifndef Expat_INCLUDED 6#define Expat_INCLUDED 1 |
7 8#ifdef __VMS 9/* 0 1 2 3 0 1 2 3 10 1234567890123456789012345678901 1234567890123456789012345678901 */ | 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 | 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 17#include <stdlib.h> | 15#endif 16 17#include <stdlib.h> |
18#include "expat_external.h" |
|
18 | 19 |
19#ifndef XMLPARSEAPI 20#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) 21#ifdef _STATIC 22#define XMLPARSEAPI(type) type __cdecl 23#else 24#define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl 25#endif 26#else 27#define XMLPARSEAPI(type) type 28#endif 29#endif /* not defined XMLPARSEAPI */ 30 | |
31#ifdef __cplusplus 32extern "C" { 33#endif 34 | 20#ifdef __cplusplus 21extern "C" { 22#endif 23 |
35#ifdef XML_UNICODE_WCHAR_T 36#define XML_UNICODE 37#endif 38 | |
39struct XML_ParserStruct; 40typedef struct XML_ParserStruct *XML_Parser; 41 | 24struct XML_ParserStruct; 25typedef struct XML_ParserStruct *XML_Parser; 26 |
42#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ 43#ifdef XML_UNICODE_WCHAR_T 44typedef wchar_t XML_Char; 45typedef wchar_t XML_LChar; 46#else 47typedef unsigned short XML_Char; 48typedef char XML_LChar; 49#endif /* XML_UNICODE_WCHAR_T */ 50#else /* Information is UTF-8 encoded. */ 51typedef char XML_Char; 52typedef char XML_LChar; 53#endif /* XML_UNICODE */ 54 | |
55/* Should this be defined using stdbool.h when C99 is available? */ 56typedef unsigned char XML_Bool; 57#define XML_TRUE ((XML_Bool) 1) 58#define XML_FALSE ((XML_Bool) 0) 59 | 27/* Should this be defined using stdbool.h when C99 is available? */ 28typedef unsigned char XML_Bool; 29#define XML_TRUE ((XML_Bool) 1) 30#define XML_FALSE ((XML_Bool) 0) 31 |
32/* The XML_Status enum gives the possible return values for several 33 API functions. The preprocessor #defines are included so this 34 stanza can be added to code that still needs to support older 35 versions of Expat 1.95.x: 36 37 #ifndef XML_STATUS_OK 38 #define XML_STATUS_OK 1 39 #define XML_STATUS_ERROR 0 40 #endif 41 42 Otherwise, the #define hackery is quite ugly and would have been 43 dropped. 44*/ 45enum XML_Status { 46 XML_STATUS_ERROR = 0, 47#define XML_STATUS_ERROR XML_STATUS_ERROR 48 XML_STATUS_OK = 1, 49#define XML_STATUS_OK XML_STATUS_OK 50 XML_STATUS_SUSPENDED = 2 51#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED 52}; 53 |
|
60enum XML_Error { 61 XML_ERROR_NONE, 62 XML_ERROR_NO_MEMORY, 63 XML_ERROR_SYNTAX, 64 XML_ERROR_NO_ELEMENTS, 65 XML_ERROR_INVALID_TOKEN, 66 XML_ERROR_UNCLOSED_TOKEN, 67 XML_ERROR_PARTIAL_CHAR, --- 11 unchanged lines hidden (view full) --- 79 XML_ERROR_UNKNOWN_ENCODING, 80 XML_ERROR_INCORRECT_ENCODING, 81 XML_ERROR_UNCLOSED_CDATA_SECTION, 82 XML_ERROR_EXTERNAL_ENTITY_HANDLING, 83 XML_ERROR_NOT_STANDALONE, 84 XML_ERROR_UNEXPECTED_STATE, 85 XML_ERROR_ENTITY_DECLARED_IN_PE, 86 XML_ERROR_FEATURE_REQUIRES_XML_DTD, | 54enum XML_Error { 55 XML_ERROR_NONE, 56 XML_ERROR_NO_MEMORY, 57 XML_ERROR_SYNTAX, 58 XML_ERROR_NO_ELEMENTS, 59 XML_ERROR_INVALID_TOKEN, 60 XML_ERROR_UNCLOSED_TOKEN, 61 XML_ERROR_PARTIAL_CHAR, --- 11 unchanged lines hidden (view full) --- 73 XML_ERROR_UNKNOWN_ENCODING, 74 XML_ERROR_INCORRECT_ENCODING, 75 XML_ERROR_UNCLOSED_CDATA_SECTION, 76 XML_ERROR_EXTERNAL_ENTITY_HANDLING, 77 XML_ERROR_NOT_STANDALONE, 78 XML_ERROR_UNEXPECTED_STATE, 79 XML_ERROR_ENTITY_DECLARED_IN_PE, 80 XML_ERROR_FEATURE_REQUIRES_XML_DTD, |
87 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING | 81 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, 82 /* Added in 1.95.7. */ 83 XML_ERROR_UNBOUND_PREFIX, 84 /* Added in 1.95.8. */ 85 XML_ERROR_UNDECLARING_PREFIX, 86 XML_ERROR_INCOMPLETE_PE, 87 XML_ERROR_XML_DECL, 88 XML_ERROR_TEXT_DECL, 89 XML_ERROR_PUBLICID, 90 XML_ERROR_SUSPENDED, 91 XML_ERROR_NOT_SUSPENDED, 92 XML_ERROR_ABORTED, 93 XML_ERROR_FINISHED, 94 XML_ERROR_SUSPEND_PE, 95 /* Added in 2.0. */ 96 XML_ERROR_RESERVED_PREFIX_XML, 97 XML_ERROR_RESERVED_PREFIX_XMLNS, 98 XML_ERROR_RESERVED_NAMESPACE_URI |
88}; 89 90enum XML_Content_Type { 91 XML_CTYPE_EMPTY = 1, 92 XML_CTYPE_ANY, 93 XML_CTYPE_MIXED, 94 XML_CTYPE_NAME, 95 XML_CTYPE_CHOICE, --- 35 unchanged lines hidden (view full) --- 131 XML_Content * children; 132}; 133 134 135/* This is called for an element declaration. See above for 136 description of the model argument. It's the caller's responsibility 137 to free model when finished with it. 138*/ | 99}; 100 101enum XML_Content_Type { 102 XML_CTYPE_EMPTY = 1, 103 XML_CTYPE_ANY, 104 XML_CTYPE_MIXED, 105 XML_CTYPE_NAME, 106 XML_CTYPE_CHOICE, --- 35 unchanged lines hidden (view full) --- 142 XML_Content * children; 143}; 144 145 146/* This is called for an element declaration. See above for 147 description of the model argument. It's the caller's responsibility 148 to free model when finished with it. 149*/ |
139typedef void (*XML_ElementDeclHandler) (void *userData, 140 const XML_Char *name, 141 XML_Content *model); | 150typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, 151 const XML_Char *name, 152 XML_Content *model); |
142 143XMLPARSEAPI(void) 144XML_SetElementDeclHandler(XML_Parser parser, 145 XML_ElementDeclHandler eldecl); 146 147/* The Attlist declaration handler is called for *each* attribute. So 148 a single Attlist declaration with multiple attributes declared will 149 generate multiple calls to this handler. The "default" parameter 150 may be NULL in the case of the "#IMPLIED" or "#REQUIRED" 151 keyword. The "isrequired" parameter will be true and the default 152 value will be NULL in the case of "#REQUIRED". If "isrequired" is 153 true and default is non-NULL, then this is a "#FIXED" default. 154*/ | 153 154XMLPARSEAPI(void) 155XML_SetElementDeclHandler(XML_Parser parser, 156 XML_ElementDeclHandler eldecl); 157 158/* The Attlist declaration handler is called for *each* attribute. So 159 a single Attlist declaration with multiple attributes declared will 160 generate multiple calls to this handler. The "default" parameter 161 may be NULL in the case of the "#IMPLIED" or "#REQUIRED" 162 keyword. The "isrequired" parameter will be true and the default 163 value will be NULL in the case of "#REQUIRED". If "isrequired" is 164 true and default is non-NULL, then this is a "#FIXED" default. 165*/ |
155typedef void (*XML_AttlistDeclHandler) (void *userData, 156 const XML_Char *elname, 157 const XML_Char *attname, 158 const XML_Char *att_type, 159 const XML_Char *dflt, 160 int isrequired); | 166typedef void (XMLCALL *XML_AttlistDeclHandler) ( 167 void *userData, 168 const XML_Char *elname, 169 const XML_Char *attname, 170 const XML_Char *att_type, 171 const XML_Char *dflt, 172 int isrequired); |
161 162XMLPARSEAPI(void) 163XML_SetAttlistDeclHandler(XML_Parser parser, 164 XML_AttlistDeclHandler attdecl); 165 166/* The XML declaration handler is called for *both* XML declarations 167 and text declarations. The way to distinguish is that the version 168 parameter will be NULL for text declarations. The encoding 169 parameter may be NULL for XML declarations. The standalone 170 parameter will be -1, 0, or 1 indicating respectively that there 171 was no standalone parameter in the declaration, that it was given 172 as no, or that it was given as yes. 173*/ | 173 174XMLPARSEAPI(void) 175XML_SetAttlistDeclHandler(XML_Parser parser, 176 XML_AttlistDeclHandler attdecl); 177 178/* The XML declaration handler is called for *both* XML declarations 179 and text declarations. The way to distinguish is that the version 180 parameter will be NULL for text declarations. The encoding 181 parameter may be NULL for XML declarations. The standalone 182 parameter will be -1, 0, or 1 indicating respectively that there 183 was no standalone parameter in the declaration, that it was given 184 as no, or that it was given as yes. 185*/ |
174typedef void (*XML_XmlDeclHandler) (void *userData, 175 const XML_Char *version, 176 const XML_Char *encoding, 177 int standalone); | 186typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, 187 const XML_Char *version, 188 const XML_Char *encoding, 189 int standalone); |
178 179XMLPARSEAPI(void) 180XML_SetXmlDeclHandler(XML_Parser parser, 181 XML_XmlDeclHandler xmldecl); 182 183 184typedef struct { 185 void *(*malloc_fcn)(size_t size); --- 10 unchanged lines hidden (view full) --- 196/* Constructs a new parser and namespace processor. Element type 197 names and attribute names that belong to a namespace will be 198 expanded; unprefixed attribute names are never expanded; unprefixed 199 element type names are expanded only if there is a default 200 namespace. The expanded name is the concatenation of the namespace 201 URI, the namespace separator character, and the local part of the 202 name. If the namespace separator is '\0' then the namespace URI 203 and the local part will be concatenated without any separator. | 190 191XMLPARSEAPI(void) 192XML_SetXmlDeclHandler(XML_Parser parser, 193 XML_XmlDeclHandler xmldecl); 194 195 196typedef struct { 197 void *(*malloc_fcn)(size_t size); --- 10 unchanged lines hidden (view full) --- 208/* Constructs a new parser and namespace processor. Element type 209 names and attribute names that belong to a namespace will be 210 expanded; unprefixed attribute names are never expanded; unprefixed 211 element type names are expanded only if there is a default 212 namespace. The expanded name is the concatenation of the namespace 213 URI, the namespace separator character, and the local part of the 214 name. If the namespace separator is '\0' then the namespace URI 215 and the local part will be concatenated without any separator. |
204 When a namespace is not declared, the name and prefix will be 205 passed through without expansion. | 216 It is a programming error to use the separator '\0' with namespace 217 triplets (see XML_SetReturnNSTriplet). |
206*/ 207XMLPARSEAPI(XML_Parser) 208XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); 209 210 | 218*/ 219XMLPARSEAPI(XML_Parser) 220XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); 221 222 |
211/* Constructs a new parser using the memory management suit referred to | 223/* Constructs a new parser using the memory management suite referred to |
212 by memsuite. If memsuite is NULL, then use the standard library memory 213 suite. If namespaceSeparator is non-NULL it creates a parser with 214 namespace processing as described above. The character pointed at 215 will serve as the namespace separator. 216 217 All further memory operations used for the created parser will come from 218 the given suite. 219*/ 220XMLPARSEAPI(XML_Parser) 221XML_ParserCreate_MM(const XML_Char *encoding, 222 const XML_Memory_Handling_Suite *memsuite, 223 const XML_Char *namespaceSeparator); 224 225/* Prepare a parser object to be re-used. This is particularly 226 valuable when memory allocation overhead is disproportionatly high, 227 such as when a large number of small documnents need to be parsed. | 224 by memsuite. If memsuite is NULL, then use the standard library memory 225 suite. If namespaceSeparator is non-NULL it creates a parser with 226 namespace processing as described above. The character pointed at 227 will serve as the namespace separator. 228 229 All further memory operations used for the created parser will come from 230 the given suite. 231*/ 232XMLPARSEAPI(XML_Parser) 233XML_ParserCreate_MM(const XML_Char *encoding, 234 const XML_Memory_Handling_Suite *memsuite, 235 const XML_Char *namespaceSeparator); 236 237/* Prepare a parser object to be re-used. This is particularly 238 valuable when memory allocation overhead is disproportionatly high, 239 such as when a large number of small documnents need to be parsed. |
228 All handlers are cleared from the parser, except for the | 240 All handlers are cleared from the parser, except for the |
229 unknownEncodingHandler. The parser's external state is re-initialized 230 except for the values of ns and ns_triplets. 231 232 Added in Expat 1.95.3. 233*/ 234XMLPARSEAPI(XML_Bool) 235XML_ParserReset(XML_Parser parser, const XML_Char *encoding); 236 237/* atts is array of name/value pairs, terminated by 0; 238 names and values are 0 terminated. 239*/ | 241 unknownEncodingHandler. The parser's external state is re-initialized 242 except for the values of ns and ns_triplets. 243 244 Added in Expat 1.95.3. 245*/ 246XMLPARSEAPI(XML_Bool) 247XML_ParserReset(XML_Parser parser, const XML_Char *encoding); 248 249/* atts is array of name/value pairs, terminated by 0; 250 names and values are 0 terminated. 251*/ |
240typedef void (*XML_StartElementHandler)(void *userData, 241 const XML_Char *name, 242 const XML_Char **atts); | 252typedef void (XMLCALL *XML_StartElementHandler) (void *userData, 253 const XML_Char *name, 254 const XML_Char **atts); |
243 | 255 |
244typedef void (*XML_EndElementHandler)(void *userData, 245 const XML_Char *name); | 256typedef void (XMLCALL *XML_EndElementHandler) (void *userData, 257 const XML_Char *name); |
246 247 248/* s is not 0 terminated. */ | 258 259 260/* s is not 0 terminated. */ |
249typedef void (*XML_CharacterDataHandler)(void *userData, 250 const XML_Char *s, 251 int len); | 261typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, 262 const XML_Char *s, 263 int len); |
252 253/* target and data are 0 terminated */ | 264 265/* target and data are 0 terminated */ |
254typedef void (*XML_ProcessingInstructionHandler)(void *userData, 255 const XML_Char *target, 256 const XML_Char *data); | 266typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( 267 void *userData, 268 const XML_Char *target, 269 const XML_Char *data); |
257 258/* data is 0 terminated */ | 270 271/* data is 0 terminated */ |
259typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); | 272typedef void (XMLCALL *XML_CommentHandler) (void *userData, 273 const XML_Char *data); |
260 | 274 |
261typedef void (*XML_StartCdataSectionHandler)(void *userData); 262typedef void (*XML_EndCdataSectionHandler)(void *userData); | 275typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); 276typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); |
263 264/* This is called for any characters in the XML document for which 265 there is no applicable handler. This includes both characters that 266 are part of markup which is of a kind that is not reported 267 (comments, markup declarations), or characters that are part of a 268 construct which could be reported but for which no handler has been 269 supplied. The characters are passed exactly as they were in the XML | 277 278/* This is called for any characters in the XML document for which 279 there is no applicable handler. This includes both characters that 280 are part of markup which is of a kind that is not reported 281 (comments, markup declarations), or characters that are part of a 282 construct which could be reported but for which no handler has been 283 supplied. The characters are passed exactly as they were in the XML |
270 document except that they will be encoded in UTF-8 or UTF-16. | 284 document except that they will be encoded in UTF-8 or UTF-16. |
271 Line boundaries are not normalized. Note that a byte order mark 272 character is not passed to the default handler. There are no 273 guarantees about how characters are divided between calls to the 274 default handler: for example, a comment might be split between 275 multiple calls. 276*/ | 285 Line boundaries are not normalized. Note that a byte order mark 286 character is not passed to the default handler. There are no 287 guarantees about how characters are divided between calls to the 288 default handler: for example, a comment might be split between 289 multiple calls. 290*/ |
277typedef void (*XML_DefaultHandler)(void *userData, 278 const XML_Char *s, 279 int len); | 291typedef void (XMLCALL *XML_DefaultHandler) (void *userData, 292 const XML_Char *s, 293 int len); |
280 281/* This is called for the start of the DOCTYPE declaration, before 282 any DTD or internal subset is parsed. 283*/ | 294 295/* This is called for the start of the DOCTYPE declaration, before 296 any DTD or internal subset is parsed. 297*/ |
284typedef void (*XML_StartDoctypeDeclHandler)(void *userData, | 298typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( 299 void *userData, |
285 const XML_Char *doctypeName, 286 const XML_Char *sysid, 287 const XML_Char *pubid, 288 int has_internal_subset); 289 290/* This is called for the start of the DOCTYPE declaration when the 291 closing > is encountered, but after processing any external 292 subset. 293*/ | 300 const XML_Char *doctypeName, 301 const XML_Char *sysid, 302 const XML_Char *pubid, 303 int has_internal_subset); 304 305/* This is called for the start of the DOCTYPE declaration when the 306 closing > is encountered, but after processing any external 307 subset. 308*/ |
294typedef void (*XML_EndDoctypeDeclHandler)(void *userData); | 309typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); |
295 296/* This is called for entity declarations. The is_parameter_entity 297 argument will be non-zero if the entity is a parameter entity, zero 298 otherwise. 299 300 For internal entities (<!ENTITY foo "bar">), value will 301 be non-NULL and systemId, publicID, and notationName will be NULL. 302 The value string is NOT nul-terminated; the length is provided in 303 the value_length argument. Since it is legal to have zero-length 304 values, do not use this argument to test for internal entities. 305 306 For external entities, value will be NULL and systemId will be 307 non-NULL. The publicId argument will be NULL unless a public 308 identifier was provided. The notationName argument will have a 309 non-NULL value only for unparsed entity declarations. 310 311 Note that is_parameter_entity can't be changed to XML_Bool, since 312 that would break binary compatibility. 313*/ | 310 311/* This is called for entity declarations. The is_parameter_entity 312 argument will be non-zero if the entity is a parameter entity, zero 313 otherwise. 314 315 For internal entities (<!ENTITY foo "bar">), value will 316 be non-NULL and systemId, publicID, and notationName will be NULL. 317 The value string is NOT nul-terminated; the length is provided in 318 the value_length argument. Since it is legal to have zero-length 319 values, do not use this argument to test for internal entities. 320 321 For external entities, value will be NULL and systemId will be 322 non-NULL. The publicId argument will be NULL unless a public 323 identifier was provided. The notationName argument will have a 324 non-NULL value only for unparsed entity declarations. 325 326 Note that is_parameter_entity can't be changed to XML_Bool, since 327 that would break binary compatibility. 328*/ |
314typedef void (*XML_EntityDeclHandler) (void *userData, 315 const XML_Char *entityName, 316 int is_parameter_entity, 317 const XML_Char *value, 318 int value_length, 319 const XML_Char *base, 320 const XML_Char *systemId, 321 const XML_Char *publicId, 322 const XML_Char *notationName); 323 | 329typedef void (XMLCALL *XML_EntityDeclHandler) ( 330 void *userData, 331 const XML_Char *entityName, 332 int is_parameter_entity, 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); 339 |
324XMLPARSEAPI(void) 325XML_SetEntityDeclHandler(XML_Parser parser, 326 XML_EntityDeclHandler handler); 327 328/* OBSOLETE -- OBSOLETE -- OBSOLETE 329 This handler has been superceded by the EntityDeclHandler above. 330 It is provided here for backward compatibility. 331 332 This is called for a declaration of an unparsed (NDATA) entity. 333 The base argument is whatever was set by XML_SetBase. The 334 entityName, systemId and notationName arguments will never be 335 NULL. The other arguments may be. 336*/ | 340XMLPARSEAPI(void) 341XML_SetEntityDeclHandler(XML_Parser parser, 342 XML_EntityDeclHandler handler); 343 344/* OBSOLETE -- OBSOLETE -- OBSOLETE 345 This handler has been superceded by the EntityDeclHandler above. 346 It is provided here for backward compatibility. 347 348 This is called for a declaration of an unparsed (NDATA) entity. 349 The base argument is whatever was set by XML_SetBase. The 350 entityName, systemId and notationName arguments will never be 351 NULL. The other arguments may be. 352*/ |
337typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, 338 const XML_Char *entityName, 339 const XML_Char *base, 340 const XML_Char *systemId, 341 const XML_Char *publicId, 342 const XML_Char *notationName); | 353typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( 354 void *userData, 355 const XML_Char *entityName, 356 const XML_Char *base, 357 const XML_Char *systemId, 358 const XML_Char *publicId, 359 const XML_Char *notationName); |
343 344/* This is called for a declaration of notation. The base argument is 345 whatever was set by XML_SetBase. The notationName will never be 346 NULL. The other arguments can be. 347*/ | 360 361/* This is called for a declaration of notation. The base argument is 362 whatever was set by XML_SetBase. The notationName will never be 363 NULL. The other arguments can be. 364*/ |
348typedef void (*XML_NotationDeclHandler)(void *userData, 349 const XML_Char *notationName, 350 const XML_Char *base, 351 const XML_Char *systemId, 352 const XML_Char *publicId); | 365typedef void (XMLCALL *XML_NotationDeclHandler) ( 366 void *userData, 367 const XML_Char *notationName, 368 const XML_Char *base, 369 const XML_Char *systemId, 370 const XML_Char *publicId); |
353 354/* When namespace processing is enabled, these are called once for 355 each namespace declaration. The call to the start and end element 356 handlers occur between the calls to the start and end namespace 357 declaration handlers. For an xmlns attribute, prefix will be 358 NULL. For an xmlns="" attribute, uri will be NULL. 359*/ | 371 372/* When namespace processing is enabled, these are called once for 373 each namespace declaration. The call to the start and end element 374 handlers occur between the calls to the start and end namespace 375 declaration handlers. For an xmlns attribute, prefix will be 376 NULL. For an xmlns="" attribute, uri will be NULL. 377*/ |
360typedef void (*XML_StartNamespaceDeclHandler)(void *userData, 361 const XML_Char *prefix, 362 const XML_Char *uri); | 378typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( 379 void *userData, 380 const XML_Char *prefix, 381 const XML_Char *uri); |
363 | 382 |
364typedef void (*XML_EndNamespaceDeclHandler)(void *userData, 365 const XML_Char *prefix); | 383typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( 384 void *userData, 385 const XML_Char *prefix); |
366 367/* This is called if the document is not standalone, that is, it has an 368 external subset or a reference to a parameter entity, but does not | 386 387/* This is called if the document is not standalone, that is, it has an 388 external subset or a reference to a parameter entity, but does not |
369 have standalone="yes". If this handler returns 0, then processing 370 will not continue, and the parser will return a | 389 have standalone="yes". If this handler returns XML_STATUS_ERROR, 390 then processing will not continue, and the parser will return a |
371 XML_ERROR_NOT_STANDALONE error. 372 If parameter entity parsing is enabled, then in addition to the 373 conditions above this handler will only be called if the referenced 374 entity was actually read. 375*/ | 391 XML_ERROR_NOT_STANDALONE error. 392 If parameter entity parsing is enabled, then in addition to the 393 conditions above this handler will only be called if the referenced 394 entity was actually read. 395*/ |
376typedef int (*XML_NotStandaloneHandler)(void *userData); | 396typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); |
377 378/* This is called for a reference to an external parsed general 379 entity. The referenced entity is not automatically parsed. The 380 application can parse it immediately or later using 381 XML_ExternalEntityParserCreate. 382 383 The parser argument is the parser parsing the entity containing the 384 reference; it can be passed as the parser argument to --- 9 unchanged lines hidden (view full) --- 394 entity declaration, or NULL if none was specified; the whitespace 395 in the public identifier will have been normalized as required by 396 the XML spec. 397 398 The context argument specifies the parsing context in the format 399 expected by the context argument to XML_ExternalEntityParserCreate; 400 context is valid only until the handler returns, so if the 401 referenced entity is to be parsed later, it must be copied. | 397 398/* This is called for a reference to an external parsed general 399 entity. The referenced entity is not automatically parsed. The 400 application can parse it immediately or later using 401 XML_ExternalEntityParserCreate. 402 403 The parser argument is the parser parsing the entity containing the 404 reference; it can be passed as the parser argument to --- 9 unchanged lines hidden (view full) --- 414 entity declaration, or NULL if none was specified; the whitespace 415 in the public identifier will have been normalized as required by 416 the XML spec. 417 418 The context argument specifies the parsing context in the format 419 expected by the context argument to XML_ExternalEntityParserCreate; 420 context is valid only until the handler returns, so if the 421 referenced entity is to be parsed later, it must be copied. |
422 context is NULL only when the entity is a parameter entity. |
|
402 | 423 |
403 The handler should return 0 if processing should not continue 404 because of a fatal error in the handling of the external entity. 405 In this case the calling parser will return an | 424 The handler should return XML_STATUS_ERROR if processing should not 425 continue because of a fatal error in the handling of the external 426 entity. In this case the calling parser will return an |
406 XML_ERROR_EXTERNAL_ENTITY_HANDLING error. 407 408 Note that unlike other handlers the first argument is the parser, 409 not userData. 410*/ | 427 XML_ERROR_EXTERNAL_ENTITY_HANDLING error. 428 429 Note that unlike other handlers the first argument is the parser, 430 not userData. 431*/ |
411typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, 412 const XML_Char *context, 413 const XML_Char *base, 414 const XML_Char *systemId, 415 const XML_Char *publicId); | 432typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( 433 XML_Parser parser, 434 const XML_Char *context, 435 const XML_Char *base, 436 const XML_Char *systemId, 437 const XML_Char *publicId); |
416 417/* This is called in two situations: 418 1) An entity reference is encountered for which no declaration 419 has been read *and* this is not an error. 420 2) An internal entity reference is read, but not expanded, because 421 XML_SetDefaultHandler has been called. 422 Note: skipped parameter entities in declarations and skipped general 423 entities in attribute values cannot be reported, because 424 the event would be out of sync with the reporting of the 425 declarations or attribute values 426*/ | 438 439/* This is called in two situations: 440 1) An entity reference is encountered for which no declaration 441 has been read *and* this is not an error. 442 2) An internal entity reference is read, but not expanded, because 443 XML_SetDefaultHandler has been called. 444 Note: skipped parameter entities in declarations and skipped general 445 entities in attribute values cannot be reported, because 446 the event would be out of sync with the reporting of the 447 declarations or attribute values 448*/ |
427typedef void (*XML_SkippedEntityHandler)(void *userData, 428 const XML_Char *entityName, 429 int is_parameter_entity); | 449typedef void (XMLCALL *XML_SkippedEntityHandler) ( 450 void *userData, 451 const XML_Char *entityName, 452 int is_parameter_entity); |
430 431/* This structure is filled in by the XML_UnknownEncodingHandler to 432 provide information to the parser about encodings that are unknown 433 to the parser. 434 435 The map[b] member gives information about byte sequences whose 436 first byte is b. 437 --- 40 unchanged lines hidden (view full) --- 478 apply to the built-in support for UTF-8 and UTF-16. 479 480 4. No Unicode character may be encoded by more than one distinct 481 sequence of bytes. 482*/ 483typedef struct { 484 int map[256]; 485 void *data; | 453 454/* This structure is filled in by the XML_UnknownEncodingHandler to 455 provide information to the parser about encodings that are unknown 456 to the parser. 457 458 The map[b] member gives information about byte sequences whose 459 first byte is b. 460 --- 40 unchanged lines hidden (view full) --- 501 apply to the built-in support for UTF-8 and UTF-16. 502 503 4. No Unicode character may be encoded by more than one distinct 504 sequence of bytes. 505*/ 506typedef struct { 507 int map[256]; 508 void *data; |
486 int (*convert)(void *data, const char *s); 487 void (*release)(void *data); | 509 int (XMLCALL *convert)(void *data, const char *s); 510 void (XMLCALL *release)(void *data); |
488} XML_Encoding; 489 490/* This is called for an encoding that is unknown to the parser. 491 492 The encodingHandlerData argument is that which was passed as the 493 second argument to XML_SetUnknownEncodingHandler. 494 495 The name argument gives the name of the encoding as specified in 496 the encoding declaration. 497 498 If the callback can provide information about the encoding, it must | 511} XML_Encoding; 512 513/* This is called for an encoding that is unknown to the parser. 514 515 The encodingHandlerData argument is that which was passed as the 516 second argument to XML_SetUnknownEncodingHandler. 517 518 The name argument gives the name of the encoding as specified in 519 the encoding declaration. 520 521 If the callback can provide information about the encoding, it must |
499 fill in the XML_Encoding structure, and return 1. Otherwise it 500 must return 0. | 522 fill in the XML_Encoding structure, and return XML_STATUS_OK. 523 Otherwise it must return XML_STATUS_ERROR. |
501 502 If info does not describe a suitable encoding, then the parser will 503 return an XML_UNKNOWN_ENCODING error. 504*/ | 524 525 If info does not describe a suitable encoding, then the parser will 526 return an XML_UNKNOWN_ENCODING error. 527*/ |
505typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, 506 const XML_Char *name, 507 XML_Encoding *info); | 528typedef int (XMLCALL *XML_UnknownEncodingHandler) ( 529 void *encodingHandlerData, 530 const XML_Char *name, 531 XML_Encoding *info); |
508 509XMLPARSEAPI(void) 510XML_SetElementHandler(XML_Parser parser, 511 XML_StartElementHandler start, 512 XML_EndElementHandler end); 513 514XMLPARSEAPI(void) | 532 533XMLPARSEAPI(void) 534XML_SetElementHandler(XML_Parser parser, 535 XML_StartElementHandler start, 536 XML_EndElementHandler end); 537 538XMLPARSEAPI(void) |
515XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); | 539XML_SetStartElementHandler(XML_Parser parser, 540 XML_StartElementHandler handler); |
516 517XMLPARSEAPI(void) | 541 542XMLPARSEAPI(void) |
518XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); | 543XML_SetEndElementHandler(XML_Parser parser, 544 XML_EndElementHandler handler); |
519 520XMLPARSEAPI(void) 521XML_SetCharacterDataHandler(XML_Parser parser, 522 XML_CharacterDataHandler handler); 523 524XMLPARSEAPI(void) 525XML_SetProcessingInstructionHandler(XML_Parser parser, 526 XML_ProcessingInstructionHandler handler); --- 72 unchanged lines hidden (view full) --- 599XML_SetExternalEntityRefHandler(XML_Parser parser, 600 XML_ExternalEntityRefHandler handler); 601 602/* If a non-NULL value for arg is specified here, then it will be 603 passed as the first argument to the external entity ref handler 604 instead of the parser object. 605*/ 606XMLPARSEAPI(void) | 545 546XMLPARSEAPI(void) 547XML_SetCharacterDataHandler(XML_Parser parser, 548 XML_CharacterDataHandler handler); 549 550XMLPARSEAPI(void) 551XML_SetProcessingInstructionHandler(XML_Parser parser, 552 XML_ProcessingInstructionHandler handler); --- 72 unchanged lines hidden (view full) --- 625XML_SetExternalEntityRefHandler(XML_Parser parser, 626 XML_ExternalEntityRefHandler handler); 627 628/* If a non-NULL value for arg is specified here, then it will be 629 passed as the first argument to the external entity ref handler 630 instead of the parser object. 631*/ 632XMLPARSEAPI(void) |
607XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); | 633XML_SetExternalEntityRefHandlerArg(XML_Parser parser, 634 void *arg); |
608 609XMLPARSEAPI(void) 610XML_SetSkippedEntityHandler(XML_Parser parser, 611 XML_SkippedEntityHandler handler); 612 613XMLPARSEAPI(void) 614XML_SetUnknownEncodingHandler(XML_Parser parser, 615 XML_UnknownEncodingHandler handler, --- 29 unchanged lines hidden (view full) --- 645 646/* Returns the last value set by XML_SetUserData or NULL. */ 647#define XML_GetUserData(parser) (*(void **)(parser)) 648 649/* This is equivalent to supplying an encoding argument to 650 XML_ParserCreate. On success XML_SetEncoding returns non-zero, 651 zero otherwise. 652 Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer | 635 636XMLPARSEAPI(void) 637XML_SetSkippedEntityHandler(XML_Parser parser, 638 XML_SkippedEntityHandler handler); 639 640XMLPARSEAPI(void) 641XML_SetUnknownEncodingHandler(XML_Parser parser, 642 XML_UnknownEncodingHandler handler, --- 29 unchanged lines hidden (view full) --- 672 673/* Returns the last value set by XML_SetUserData or NULL. */ 674#define XML_GetUserData(parser) (*(void **)(parser)) 675 676/* This is equivalent to supplying an encoding argument to 677 XML_ParserCreate. On success XML_SetEncoding returns non-zero, 678 zero otherwise. 679 Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer |
653 has no effect and returns zero. | 680 has no effect and returns XML_STATUS_ERROR. |
654*/ | 681*/ |
655XMLPARSEAPI(int) | 682XMLPARSEAPI(enum XML_Status) |
656XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); 657 658/* If this function is called, then the parser will be passed as the 659 first argument to callbacks instead of userData. The userData will 660 still be accessible using XML_GetUserData. 661*/ 662XMLPARSEAPI(void) 663XML_UseParserAsHandlerArg(XML_Parser parser); 664 665/* If useDTD == XML_TRUE is passed to this function, then the parser 666 will assume that there is an external subset, even if none is 667 specified in the document. In such a case the parser will call the 668 externalEntityRefHandler with a value of NULL for the systemId 669 argument (the publicId and context arguments will be NULL as well). | 683XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); 684 685/* If this function is called, then the parser will be passed as the 686 first argument to callbacks instead of userData. The userData will 687 still be accessible using XML_GetUserData. 688*/ 689XMLPARSEAPI(void) 690XML_UseParserAsHandlerArg(XML_Parser parser); 691 692/* If useDTD == XML_TRUE is passed to this function, then the parser 693 will assume that there is an external subset, even if none is 694 specified in the document. In such a case the parser will call the 695 externalEntityRefHandler with a value of NULL for the systemId 696 argument (the publicId and context arguments will be NULL as well). |
697 Note: For the purpose of checking WFC: Entity Declared, passing 698 useDTD == XML_TRUE will make the parser behave as if the document 699 had a DTD with an external subset. |
|
670 Note: If this function is called, then this must be done before 671 the first call to XML_Parse or XML_ParseBuffer, since it will 672 have no effect after that. Returns 673 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. 674 Note: If the document does not have a DOCTYPE declaration at all, 675 then startDoctypeDeclHandler and endDoctypeDeclHandler will not 676 be called, despite an external subset being parsed. 677 Note: If XML_DTD is not defined when Expat is compiled, returns 678 XML_ERROR_FEATURE_REQUIRES_XML_DTD. 679*/ 680XMLPARSEAPI(enum XML_Error) 681XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); 682 683 684/* Sets the base to be used for resolving relative URIs in system 685 identifiers in declarations. Resolving relative identifiers is 686 left to the application: this value will be passed through as the 687 base argument to the XML_ExternalEntityRefHandler, 688 XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base | 700 Note: If this function is called, then this must be done before 701 the first call to XML_Parse or XML_ParseBuffer, since it will 702 have no effect after that. Returns 703 XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. 704 Note: If the document does not have a DOCTYPE declaration at all, 705 then startDoctypeDeclHandler and endDoctypeDeclHandler will not 706 be called, despite an external subset being parsed. 707 Note: If XML_DTD is not defined when Expat is compiled, returns 708 XML_ERROR_FEATURE_REQUIRES_XML_DTD. 709*/ 710XMLPARSEAPI(enum XML_Error) 711XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); 712 713 714/* Sets the base to be used for resolving relative URIs in system 715 identifiers in declarations. Resolving relative identifiers is 716 left to the application: this value will be passed through as the 717 base argument to the XML_ExternalEntityRefHandler, 718 XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base |
689 argument will be copied. Returns zero if out of memory, non-zero 690 otherwise. | 719 argument will be copied. Returns XML_STATUS_ERROR if out of memory, 720 XML_STATUS_OK otherwise. |
691*/ | 721*/ |
692XMLPARSEAPI(int) | 722XMLPARSEAPI(enum XML_Status) |
693XML_SetBase(XML_Parser parser, const XML_Char *base); 694 695XMLPARSEAPI(const XML_Char *) 696XML_GetBase(XML_Parser parser); 697 698/* Returns the number of the attribute/value pairs passed in last call 699 to the XML_StartElementHandler that were specified in the start-tag 700 rather than defaulted. Each attribute/value pair counts as 2; thus --- 10 unchanged lines hidden (view full) --- 711*/ 712XMLPARSEAPI(int) 713XML_GetIdAttributeIndex(XML_Parser parser); 714 715/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is 716 detected. The last call to XML_Parse must have isFinal true; len 717 may be zero for this call (or any other). 718 | 723XML_SetBase(XML_Parser parser, const XML_Char *base); 724 725XMLPARSEAPI(const XML_Char *) 726XML_GetBase(XML_Parser parser); 727 728/* Returns the number of the attribute/value pairs passed in last call 729 to the XML_StartElementHandler that were specified in the start-tag 730 rather than defaulted. Each attribute/value pair counts as 2; thus --- 10 unchanged lines hidden (view full) --- 741*/ 742XMLPARSEAPI(int) 743XML_GetIdAttributeIndex(XML_Parser parser); 744 745/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is 746 detected. The last call to XML_Parse must have isFinal true; len 747 may be zero for this call (or any other). 748 |
719 The XML_Status enum gives the possible return values for the 720 XML_Parse and XML_ParseBuffer functions. Though the return values 721 for these functions has always been described as a Boolean value, 722 the implementation, at least for the 1.95.x series, has always 723 returned exactly one of these values. The preprocessor #defines 724 are included so this stanza can be added to code that still needs 725 to support older versions of Expat 1.95.x: 726 727 #ifndef XML_STATUS_OK 728 #define XML_STATUS_OK 1 729 #define XML_STATUS_ERROR 0 730 #endif 731 732 Otherwise, the #define hackery is quite ugly and would have been dropped. | 749 Though the return values for these functions has always been 750 described as a Boolean value, the implementation, at least for the 751 1.95.x series, has always returned exactly one of the XML_Status 752 values. |
733*/ | 753*/ |
734enum XML_Status { 735 XML_STATUS_ERROR = 0, 736#define XML_STATUS_ERROR XML_STATUS_ERROR 737 XML_STATUS_OK = 1 738#define XML_STATUS_OK XML_STATUS_OK 739}; 740 | |
741XMLPARSEAPI(enum XML_Status) 742XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); 743 744XMLPARSEAPI(void *) 745XML_GetBuffer(XML_Parser parser, int len); 746 747XMLPARSEAPI(enum XML_Status) 748XML_ParseBuffer(XML_Parser parser, int len, int isFinal); 749 | 754XMLPARSEAPI(enum XML_Status) 755XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); 756 757XMLPARSEAPI(void *) 758XML_GetBuffer(XML_Parser parser, int len); 759 760XMLPARSEAPI(enum XML_Status) 761XML_ParseBuffer(XML_Parser parser, int len, int isFinal); 762 |
763/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. 764 Must be called from within a call-back handler, except when aborting 765 (resumable = 0) an already suspended parser. Some call-backs may 766 still follow because they would otherwise get lost. Examples: 767 - endElementHandler() for empty elements when stopped in 768 startElementHandler(), 769 - endNameSpaceDeclHandler() when stopped in endElementHandler(), 770 and possibly others. 771 772 Can be called from most handlers, including DTD related call-backs, 773 except when parsing an external parameter entity and resumable != 0. 774 Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. 775 Possible error codes: 776 - XML_ERROR_SUSPENDED: when suspending an already suspended parser. 777 - XML_ERROR_FINISHED: when the parser has already finished. 778 - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. 779 780 When resumable != 0 (true) then parsing is suspended, that is, 781 XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. 782 Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() 783 return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. 784 785 *Note*: 786 This will be applied to the current parser instance only, that is, if 787 there is a parent parser then it will continue parsing when the 788 externalEntityRefHandler() returns. It is up to the implementation of 789 the externalEntityRefHandler() to call XML_StopParser() on the parent 790 parser (recursively), if one wants to stop parsing altogether. 791 792 When suspended, parsing can be resumed by calling XML_ResumeParser(). 793*/ 794XMLPARSEAPI(enum XML_Status) 795XML_StopParser(XML_Parser parser, XML_Bool resumable); 796 797/* Resumes parsing after it has been suspended with XML_StopParser(). 798 Must not be called from within a handler call-back. Returns same 799 status codes as XML_Parse() or XML_ParseBuffer(). 800 Additional error code XML_ERROR_NOT_SUSPENDED possible. 801 802 *Note*: 803 This must be called on the most deeply nested child parser instance 804 first, and on its parent parser only after the child parser has finished, 805 to be applied recursively until the document entity's parser is restarted. 806 That is, the parent parser will not resume by itself and it is up to the 807 application to call XML_ResumeParser() on it at the appropriate moment. 808*/ 809XMLPARSEAPI(enum XML_Status) 810XML_ResumeParser(XML_Parser parser); 811 812enum XML_Parsing { 813 XML_INITIALIZED, 814 XML_PARSING, 815 XML_FINISHED, 816 XML_SUSPENDED 817}; 818 819typedef struct { 820 enum XML_Parsing parsing; 821 XML_Bool finalBuffer; 822} XML_ParsingStatus; 823 824/* Returns status of parser with respect to being initialized, parsing, 825 finished, or suspended and processing the final buffer. 826 XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, 827 XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED 828*/ 829XMLPARSEAPI(void) 830XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); 831 |
|
750/* Creates an XML_Parser object that can parse an external general 751 entity; context is a '\0'-terminated string specifying the parse 752 context; encoding is a '\0'-terminated string giving the name of 753 the externally specified encoding, or NULL if there is no 754 externally specified encoding. The context string consists of a 755 sequence of tokens separated by formfeeds (\f); a token consisting 756 of a name specifies that the general entity of the name is open; a 757 token of the form prefix=uri specifies the namespace for a 758 particular prefix; a token of the form =uri specifies the default 759 namespace. This can be called at any point after the first call to 760 an ExternalEntityRefHandler so longer as the parser has not yet 761 been freed. The new parser is completely independent and may 762 safely be used in a separate thread. The handlers and userData are | 832/* Creates an XML_Parser object that can parse an external general 833 entity; context is a '\0'-terminated string specifying the parse 834 context; encoding is a '\0'-terminated string giving the name of 835 the externally specified encoding, or NULL if there is no 836 externally specified encoding. The context string consists of a 837 sequence of tokens separated by formfeeds (\f); a token consisting 838 of a name specifies that the general entity of the name is open; a 839 token of the form prefix=uri specifies the namespace for a 840 particular prefix; a token of the form =uri specifies the default 841 namespace. This can be called at any point after the first call to 842 an ExternalEntityRefHandler so longer as the parser has not yet 843 been freed. The new parser is completely independent and may 844 safely be used in a separate thread. The handlers and userData are |
763 initialized from the parser argument. Returns 0 if out of memory. | 845 initialized from the parser argument. Returns NULL if out of memory. |
764 Otherwise returns a new XML_Parser object. 765*/ 766XMLPARSEAPI(XML_Parser) 767XML_ExternalEntityParserCreate(XML_Parser parser, 768 const XML_Char *context, 769 const XML_Char *encoding); 770 771enum XML_ParamEntityParsing { --- 24 unchanged lines hidden (view full) --- 796 entities is requested; otherwise it will return non-zero. 797 Note: If XML_SetParamEntityParsing is called after XML_Parse or 798 XML_ParseBuffer, then it has no effect and will always return 0. 799*/ 800XMLPARSEAPI(int) 801XML_SetParamEntityParsing(XML_Parser parser, 802 enum XML_ParamEntityParsing parsing); 803 | 846 Otherwise returns a new XML_Parser object. 847*/ 848XMLPARSEAPI(XML_Parser) 849XML_ExternalEntityParserCreate(XML_Parser parser, 850 const XML_Char *context, 851 const XML_Char *encoding); 852 853enum XML_ParamEntityParsing { --- 24 unchanged lines hidden (view full) --- 878 entities is requested; otherwise it will return non-zero. 879 Note: If XML_SetParamEntityParsing is called after XML_Parse or 880 XML_ParseBuffer, then it has no effect and will always return 0. 881*/ 882XMLPARSEAPI(int) 883XML_SetParamEntityParsing(XML_Parser parser, 884 enum XML_ParamEntityParsing parsing); 885 |
804/* If XML_Parse or XML_ParseBuffer have returned 0, then | 886/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then |
805 XML_GetErrorCode returns information about the error. 806*/ 807XMLPARSEAPI(enum XML_Error) 808XML_GetErrorCode(XML_Parser parser); 809 810/* These functions return information about the current parse | 887 XML_GetErrorCode returns information about the error. 888*/ 889XMLPARSEAPI(enum XML_Error) 890XML_GetErrorCode(XML_Parser parser); 891 892/* These functions return information about the current parse |
811 location. They may be called when XML_Parse or XML_ParseBuffer 812 return 0; in this case the location is the location of the 813 character at which the error was detected. 814 815 They may also be called from any other callback called to report 816 some parse event; in this the location is the location of the first 817 of the sequence of characters that generated the event. | 893 location. They may be called from any callback called to report 894 some parse event; in this case the location is the location of the 895 first of the sequence of characters that generated the event. When 896 called from callbacks generated by declarations in the document 897 prologue, the location identified isn't as neatly defined, but will 898 be within the relevant markup. When called outside of the callback 899 functions, the position indicated will be just past the last parse 900 event (regardless of whether there was an associated callback). 901 902 They may also be called after returning from a call to XML_Parse 903 or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then 904 the location is the location of the character at which the error 905 was detected; otherwise the location is the location of the last 906 parse event, as described above. |
818*/ | 907*/ |
819XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser); 820XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser); 821XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser); | 908XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); 909XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); 910XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); |
822 823/* Return the number of bytes in the current event. 824 Returns 0 if the event is in an internal entity. 825*/ 826XMLPARSEAPI(int) 827XML_GetCurrentByteCount(XML_Parser parser); 828 829/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets --- 11 unchanged lines hidden (view full) --- 841 int *offset, 842 int *size); 843 844/* For backwards compatibility with previous versions. */ 845#define XML_GetErrorLineNumber XML_GetCurrentLineNumber 846#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber 847#define XML_GetErrorByteIndex XML_GetCurrentByteIndex 848 | 911 912/* Return the number of bytes in the current event. 913 Returns 0 if the event is in an internal entity. 914*/ 915XMLPARSEAPI(int) 916XML_GetCurrentByteCount(XML_Parser parser); 917 918/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets --- 11 unchanged lines hidden (view full) --- 930 int *offset, 931 int *size); 932 933/* For backwards compatibility with previous versions. */ 934#define XML_GetErrorLineNumber XML_GetCurrentLineNumber 935#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber 936#define XML_GetErrorByteIndex XML_GetCurrentByteIndex 937 |
938/* Frees the content model passed to the element declaration handler */ 939XMLPARSEAPI(void) 940XML_FreeContentModel(XML_Parser parser, XML_Content *model); 941 942/* Exposing the memory handling functions used in Expat */ 943XMLPARSEAPI(void *) 944XML_MemMalloc(XML_Parser parser, size_t size); 945 946XMLPARSEAPI(void *) 947XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); 948 949XMLPARSEAPI(void) 950XML_MemFree(XML_Parser parser, void *ptr); 951 |
|
849/* Frees memory used by the parser. */ 850XMLPARSEAPI(void) 851XML_ParserFree(XML_Parser parser); 852 853/* Returns a string describing the error. */ 854XMLPARSEAPI(const XML_LChar *) 855XML_ErrorString(enum XML_Error code); 856 --- 17 unchanged lines hidden (view full) --- 874enum XML_FeatureEnum { 875 XML_FEATURE_END = 0, 876 XML_FEATURE_UNICODE, 877 XML_FEATURE_UNICODE_WCHAR_T, 878 XML_FEATURE_DTD, 879 XML_FEATURE_CONTEXT_BYTES, 880 XML_FEATURE_MIN_SIZE, 881 XML_FEATURE_SIZEOF_XML_CHAR, | 952/* Frees memory used by the parser. */ 953XMLPARSEAPI(void) 954XML_ParserFree(XML_Parser parser); 955 956/* Returns a string describing the error. */ 957XMLPARSEAPI(const XML_LChar *) 958XML_ErrorString(enum XML_Error code); 959 --- 17 unchanged lines hidden (view full) --- 977enum XML_FeatureEnum { 978 XML_FEATURE_END = 0, 979 XML_FEATURE_UNICODE, 980 XML_FEATURE_UNICODE_WCHAR_T, 981 XML_FEATURE_DTD, 982 XML_FEATURE_CONTEXT_BYTES, 983 XML_FEATURE_MIN_SIZE, 984 XML_FEATURE_SIZEOF_XML_CHAR, |
882 XML_FEATURE_SIZEOF_XML_LCHAR | 985 XML_FEATURE_SIZEOF_XML_LCHAR, 986 XML_FEATURE_NS, 987 XML_FEATURE_LARGE_SIZE |
883 /* Additional features must be added to the end of this enum. */ 884}; 885 886typedef struct { 887 enum XML_FeatureEnum feature; | 988 /* Additional features must be added to the end of this enum. */ 989}; 990 991typedef struct { 992 enum XML_FeatureEnum feature; |
888 XML_LChar *name; | 993 const XML_LChar *name; |
889 long int value; 890} XML_Feature; 891 892XMLPARSEAPI(const XML_Feature *) 893XML_GetFeatureList(void); 894 895 896/* Expat follows the GNU/Linux convention of odd number minor version for 897 beta/development releases and even number minor version for stable 898 releases. Micro is bumped with each release, and set to 0 with each 899 change to major or minor version. 900*/ | 994 long int value; 995} XML_Feature; 996 997XMLPARSEAPI(const XML_Feature *) 998XML_GetFeatureList(void); 999 1000 1001/* Expat follows the GNU/Linux convention of odd number minor version for 1002 beta/development releases and even number minor version for stable 1003 releases. Micro is bumped with each release, and set to 0 with each 1004 change to major or minor version. 1005*/ |
901#define XML_MAJOR_VERSION 1 902#define XML_MINOR_VERSION 95 903#define XML_MICRO_VERSION 5 | 1006#define XML_MAJOR_VERSION 2 1007#define XML_MINOR_VERSION 0 1008#define XML_MICRO_VERSION 1 |
904 905#ifdef __cplusplus 906} 907#endif 908 | 1009 1010#ifdef __cplusplus 1011} 1012#endif 1013 |
909#endif /* not XmlParse_INCLUDED */ | 1014#endif /* not Expat_INCLUDED */ |