[b7d3cc34] | 1 | /* |
---|
| 2 | The contents of this file are subject to the Mozilla Public License |
---|
| 3 | Version 1.1 (the "License"); you may not use this file except in |
---|
| 4 | compliance with the License. You may obtain a copy of the License at |
---|
| 5 | http://www.mozilla.org/MPL/ |
---|
| 6 | |
---|
| 7 | Software distributed under the License is distributed on an "AS IS" |
---|
| 8 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
---|
| 9 | License for the specific language governing rights and limitations |
---|
| 10 | under the License. |
---|
| 11 | |
---|
| 12 | The Original Code is expat. |
---|
| 13 | |
---|
| 14 | The Initial Developer of the Original Code is James Clark. |
---|
| 15 | Portions created by James Clark are Copyright (C) 1998, 1999 |
---|
| 16 | James Clark. All Rights Reserved. |
---|
| 17 | |
---|
| 18 | Contributor(s): |
---|
| 19 | |
---|
| 20 | Alternatively, the contents of this file may be used under the terms |
---|
| 21 | of the GNU General Public License (the "GPL"), in which case the |
---|
| 22 | provisions of the GPL are applicable instead of those above. If you |
---|
| 23 | wish to allow use of your version of this file only under the terms of |
---|
| 24 | the GPL and not to allow others to use your version of this file under |
---|
| 25 | the MPL, indicate your decision by deleting the provisions above and |
---|
| 26 | replace them with the notice and other provisions required by the |
---|
| 27 | GPL. If you do not delete the provisions above, a recipient may use |
---|
| 28 | your version of this file under either the MPL or the GPL. |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | #ifndef XmlParse_INCLUDED |
---|
| 32 | #define XmlParse_INCLUDED 1 |
---|
| 33 | |
---|
| 34 | #ifdef __cplusplus |
---|
| 35 | extern "C" { |
---|
| 36 | #endif |
---|
| 37 | |
---|
| 38 | #ifndef XMLPARSEAPI |
---|
| 39 | #define XMLPARSEAPI /* as nothing */ |
---|
| 40 | #endif |
---|
| 41 | |
---|
| 42 | typedef void *XML_Parser; |
---|
| 43 | |
---|
| 44 | #ifdef XML_UNICODE_WCHAR_T |
---|
| 45 | |
---|
| 46 | /* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t |
---|
| 47 | uses Unicode. */ |
---|
| 48 | /* Information is UTF-16 encoded as wchar_ts */ |
---|
| 49 | |
---|
| 50 | #ifndef XML_UNICODE |
---|
| 51 | #define XML_UNICODE |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #include <stddef.h> |
---|
| 55 | typedef wchar_t XML_Char; |
---|
| 56 | typedef wchar_t XML_LChar; |
---|
| 57 | |
---|
| 58 | #else /* not XML_UNICODE_WCHAR_T */ |
---|
| 59 | |
---|
| 60 | #ifdef XML_UNICODE |
---|
| 61 | |
---|
| 62 | /* Information is UTF-16 encoded as unsigned shorts */ |
---|
| 63 | typedef unsigned short XML_Char; |
---|
| 64 | typedef char XML_LChar; |
---|
| 65 | |
---|
| 66 | #else /* not XML_UNICODE */ |
---|
| 67 | |
---|
| 68 | /* Information is UTF-8 encoded. */ |
---|
| 69 | typedef char XML_Char; |
---|
| 70 | typedef char XML_LChar; |
---|
| 71 | |
---|
| 72 | #endif /* not XML_UNICODE */ |
---|
| 73 | |
---|
| 74 | #endif /* not XML_UNICODE_WCHAR_T */ |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | /* Constructs a new parser; encoding is the encoding specified by the external |
---|
| 78 | protocol or null if there is none specified. */ |
---|
| 79 | |
---|
| 80 | XML_Parser XMLPARSEAPI |
---|
| 81 | XML_ParserCreate(const XML_Char *encoding); |
---|
| 82 | |
---|
| 83 | /* Constructs a new parser and namespace processor. Element type names |
---|
| 84 | and attribute names that belong to a namespace will be expanded; |
---|
| 85 | unprefixed attribute names are never expanded; unprefixed element type |
---|
| 86 | names are expanded only if there is a default namespace. The expanded |
---|
| 87 | name is the concatenation of the namespace URI, the namespace separator character, |
---|
| 88 | and the local part of the name. If the namespace separator is '\0' then |
---|
| 89 | the namespace URI and the local part will be concatenated without any |
---|
| 90 | separator. When a namespace is not declared, the name and prefix will be |
---|
| 91 | passed through without expansion. */ |
---|
| 92 | |
---|
| 93 | XML_Parser XMLPARSEAPI |
---|
| 94 | XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | /* atts is array of name/value pairs, terminated by 0; |
---|
| 98 | names and values are 0 terminated. */ |
---|
| 99 | |
---|
| 100 | typedef void (*XML_StartElementHandler)(void *userData, |
---|
| 101 | const XML_Char *name, |
---|
| 102 | const XML_Char **atts); |
---|
| 103 | |
---|
| 104 | typedef void (*XML_EndElementHandler)(void *userData, |
---|
| 105 | const XML_Char *name); |
---|
| 106 | |
---|
| 107 | /* s is not 0 terminated. */ |
---|
| 108 | typedef void (*XML_CharacterDataHandler)(void *userData, |
---|
| 109 | const XML_Char *s, |
---|
| 110 | int len); |
---|
| 111 | |
---|
| 112 | /* target and data are 0 terminated */ |
---|
| 113 | typedef void (*XML_ProcessingInstructionHandler)(void *userData, |
---|
| 114 | const XML_Char *target, |
---|
| 115 | const XML_Char *data); |
---|
| 116 | |
---|
| 117 | /* data is 0 terminated */ |
---|
| 118 | typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); |
---|
| 119 | |
---|
| 120 | typedef void (*XML_StartCdataSectionHandler)(void *userData); |
---|
| 121 | typedef void (*XML_EndCdataSectionHandler)(void *userData); |
---|
| 122 | |
---|
| 123 | /* This is called for any characters in the XML document for |
---|
| 124 | which there is no applicable handler. This includes both |
---|
| 125 | characters that are part of markup which is of a kind that is |
---|
| 126 | not reported (comments, markup declarations), or characters |
---|
| 127 | that are part of a construct which could be reported but |
---|
| 128 | for which no handler has been supplied. The characters are passed |
---|
| 129 | exactly as they were in the XML document except that |
---|
| 130 | they will be encoded in UTF-8. Line boundaries are not normalized. |
---|
| 131 | Note that a byte order mark character is not passed to the default handler. |
---|
| 132 | There are no guarantees about how characters are divided between calls |
---|
| 133 | to the default handler: for example, a comment might be split between |
---|
| 134 | multiple calls. */ |
---|
| 135 | |
---|
| 136 | typedef void (*XML_DefaultHandler)(void *userData, |
---|
| 137 | const XML_Char *s, |
---|
| 138 | int len); |
---|
| 139 | |
---|
| 140 | /* This is called for a declaration of an unparsed (NDATA) |
---|
| 141 | entity. The base argument is whatever was set by XML_SetBase. |
---|
| 142 | The entityName, systemId and notationName arguments will never be null. |
---|
| 143 | The other arguments may be. */ |
---|
| 144 | |
---|
| 145 | typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, |
---|
| 146 | const XML_Char *entityName, |
---|
| 147 | const XML_Char *base, |
---|
| 148 | const XML_Char *systemId, |
---|
| 149 | const XML_Char *publicId, |
---|
| 150 | const XML_Char *notationName); |
---|
| 151 | |
---|
| 152 | /* This is called for a declaration of notation. |
---|
| 153 | The base argument is whatever was set by XML_SetBase. |
---|
| 154 | The notationName will never be null. The other arguments can be. */ |
---|
| 155 | |
---|
| 156 | typedef void (*XML_NotationDeclHandler)(void *userData, |
---|
| 157 | const XML_Char *notationName, |
---|
| 158 | const XML_Char *base, |
---|
| 159 | const XML_Char *systemId, |
---|
| 160 | const XML_Char *publicId); |
---|
| 161 | |
---|
| 162 | /* When namespace processing is enabled, these are called once for |
---|
| 163 | each namespace declaration. The call to the start and end element |
---|
| 164 | handlers occur between the calls to the start and end namespace |
---|
| 165 | declaration handlers. For an xmlns attribute, prefix will be null. |
---|
| 166 | For an xmlns="" attribute, uri will be null. */ |
---|
| 167 | |
---|
| 168 | typedef void (*XML_StartNamespaceDeclHandler)(void *userData, |
---|
| 169 | const XML_Char *prefix, |
---|
| 170 | const XML_Char *uri); |
---|
| 171 | |
---|
| 172 | typedef void (*XML_EndNamespaceDeclHandler)(void *userData, |
---|
| 173 | const XML_Char *prefix); |
---|
| 174 | |
---|
| 175 | /* This is called if the document is not standalone (it has an |
---|
| 176 | external subset or a reference to a parameter entity, but does not |
---|
| 177 | have standalone="yes"). If this handler returns 0, then processing |
---|
| 178 | will not continue, and the parser will return a |
---|
| 179 | XML_ERROR_NOT_STANDALONE error. */ |
---|
| 180 | |
---|
| 181 | typedef int (*XML_NotStandaloneHandler)(void *userData); |
---|
| 182 | |
---|
| 183 | /* This is called for a reference to an external parsed general entity. |
---|
| 184 | The referenced entity is not automatically parsed. |
---|
| 185 | The application can parse it immediately or later using |
---|
| 186 | XML_ExternalEntityParserCreate. |
---|
| 187 | The parser argument is the parser parsing the entity containing the reference; |
---|
| 188 | it can be passed as the parser argument to XML_ExternalEntityParserCreate. |
---|
| 189 | The systemId argument is the system identifier as specified in the entity declaration; |
---|
| 190 | it will not be null. |
---|
| 191 | The base argument is the system identifier that should be used as the base for |
---|
| 192 | resolving systemId if systemId was relative; this is set by XML_SetBase; |
---|
| 193 | it may be null. |
---|
| 194 | The publicId argument is the public identifier as specified in the entity declaration, |
---|
| 195 | or null if none was specified; the whitespace in the public identifier |
---|
| 196 | will have been normalized as required by the XML spec. |
---|
| 197 | The context argument specifies the parsing context in the format |
---|
| 198 | expected by the context argument to |
---|
| 199 | XML_ExternalEntityParserCreate; context is valid only until the handler |
---|
| 200 | returns, so if the referenced entity is to be parsed later, it must be copied. |
---|
| 201 | The handler should return 0 if processing should not continue because of |
---|
| 202 | a fatal error in the handling of the external entity. |
---|
| 203 | In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING |
---|
| 204 | error. |
---|
| 205 | Note that unlike other handlers the first argument is the parser, not userData. */ |
---|
| 206 | |
---|
| 207 | typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, |
---|
| 208 | const XML_Char *context, |
---|
| 209 | const XML_Char *base, |
---|
| 210 | const XML_Char *systemId, |
---|
| 211 | const XML_Char *publicId); |
---|
| 212 | |
---|
| 213 | /* This structure is filled in by the XML_UnknownEncodingHandler |
---|
| 214 | to provide information to the parser about encodings that are unknown |
---|
| 215 | to the parser. |
---|
| 216 | The map[b] member gives information about byte sequences |
---|
| 217 | whose first byte is b. |
---|
| 218 | If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c. |
---|
| 219 | If map[b] is -1, then the byte sequence is malformed. |
---|
| 220 | If map[b] is -n, where n >= 2, then b is the first byte of an n-byte |
---|
| 221 | sequence that encodes a single Unicode scalar value. |
---|
| 222 | The data member will be passed as the first argument to the convert function. |
---|
| 223 | The convert function is used to convert multibyte sequences; |
---|
| 224 | s will point to a n-byte sequence where map[(unsigned char)*s] == -n. |
---|
| 225 | The convert function must return the Unicode scalar value |
---|
| 226 | represented by this byte sequence or -1 if the byte sequence is malformed. |
---|
| 227 | The convert function may be null if the encoding is a single-byte encoding, |
---|
| 228 | that is if map[b] >= -1 for all bytes b. |
---|
| 229 | When the parser is finished with the encoding, then if release is not null, |
---|
| 230 | it will call release passing it the data member; |
---|
| 231 | once release has been called, the convert function will not be called again. |
---|
| 232 | |
---|
| 233 | Expat places certain restrictions on the encodings that are supported |
---|
| 234 | using this mechanism. |
---|
| 235 | |
---|
| 236 | 1. Every ASCII character that can appear in a well-formed XML document, |
---|
| 237 | other than the characters |
---|
| 238 | |
---|
| 239 | $@\^`{}~ |
---|
| 240 | |
---|
| 241 | must be represented by a single byte, and that byte must be the |
---|
| 242 | same byte that represents that character in ASCII. |
---|
| 243 | |
---|
| 244 | 2. No character may require more than 4 bytes to encode. |
---|
| 245 | |
---|
| 246 | 3. All characters encoded must have Unicode scalar values <= 0xFFFF, |
---|
| 247 | (ie characters that would be encoded by surrogates in UTF-16 |
---|
| 248 | are not allowed). Note that this restriction doesn't apply to |
---|
| 249 | the built-in support for UTF-8 and UTF-16. |
---|
| 250 | |
---|
| 251 | 4. No Unicode character may be encoded by more than one distinct sequence |
---|
| 252 | of bytes. */ |
---|
| 253 | |
---|
| 254 | typedef struct { |
---|
| 255 | int map[256]; |
---|
| 256 | void *data; |
---|
| 257 | int (*convert)(void *data, const char *s); |
---|
| 258 | void (*release)(void *data); |
---|
| 259 | } XML_Encoding; |
---|
| 260 | |
---|
| 261 | /* This is called for an encoding that is unknown to the parser. |
---|
| 262 | The encodingHandlerData argument is that which was passed as the |
---|
| 263 | second argument to XML_SetUnknownEncodingHandler. |
---|
| 264 | The name argument gives the name of the encoding as specified in |
---|
| 265 | the encoding declaration. |
---|
| 266 | If the callback can provide information about the encoding, |
---|
| 267 | it must fill in the XML_Encoding structure, and return 1. |
---|
| 268 | Otherwise it must return 0. |
---|
| 269 | If info does not describe a suitable encoding, |
---|
| 270 | then the parser will return an XML_UNKNOWN_ENCODING error. */ |
---|
| 271 | |
---|
| 272 | typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, |
---|
| 273 | const XML_Char *name, |
---|
| 274 | XML_Encoding *info); |
---|
| 275 | |
---|
| 276 | void XMLPARSEAPI |
---|
| 277 | XML_SetElementHandler(XML_Parser parser, |
---|
| 278 | XML_StartElementHandler start, |
---|
| 279 | XML_EndElementHandler end); |
---|
| 280 | |
---|
| 281 | void XMLPARSEAPI |
---|
| 282 | XML_SetCharacterDataHandler(XML_Parser parser, |
---|
| 283 | XML_CharacterDataHandler handler); |
---|
| 284 | |
---|
| 285 | void XMLPARSEAPI |
---|
| 286 | XML_SetProcessingInstructionHandler(XML_Parser parser, |
---|
| 287 | XML_ProcessingInstructionHandler handler); |
---|
| 288 | void XMLPARSEAPI |
---|
| 289 | XML_SetCommentHandler(XML_Parser parser, |
---|
| 290 | XML_CommentHandler handler); |
---|
| 291 | |
---|
| 292 | void XMLPARSEAPI |
---|
| 293 | XML_SetCdataSectionHandler(XML_Parser parser, |
---|
| 294 | XML_StartCdataSectionHandler start, |
---|
| 295 | XML_EndCdataSectionHandler end); |
---|
| 296 | |
---|
| 297 | /* This sets the default handler and also inhibits expansion of internal entities. |
---|
| 298 | The entity reference will be passed to the default handler. */ |
---|
| 299 | |
---|
| 300 | void XMLPARSEAPI |
---|
| 301 | XML_SetDefaultHandler(XML_Parser parser, |
---|
| 302 | XML_DefaultHandler handler); |
---|
| 303 | |
---|
| 304 | /* This sets the default handler but does not inhibit expansion of internal entities. |
---|
| 305 | The entity reference will not be passed to the default handler. */ |
---|
| 306 | |
---|
| 307 | void XMLPARSEAPI |
---|
| 308 | XML_SetDefaultHandlerExpand(XML_Parser parser, |
---|
| 309 | XML_DefaultHandler handler); |
---|
| 310 | |
---|
| 311 | void XMLPARSEAPI |
---|
| 312 | XML_SetUnparsedEntityDeclHandler(XML_Parser parser, |
---|
| 313 | XML_UnparsedEntityDeclHandler handler); |
---|
| 314 | |
---|
| 315 | void XMLPARSEAPI |
---|
| 316 | XML_SetNotationDeclHandler(XML_Parser parser, |
---|
| 317 | XML_NotationDeclHandler handler); |
---|
| 318 | |
---|
| 319 | void XMLPARSEAPI |
---|
| 320 | XML_SetNamespaceDeclHandler(XML_Parser parser, |
---|
| 321 | XML_StartNamespaceDeclHandler start, |
---|
| 322 | XML_EndNamespaceDeclHandler end); |
---|
| 323 | |
---|
| 324 | void XMLPARSEAPI |
---|
| 325 | XML_SetNotStandaloneHandler(XML_Parser parser, |
---|
| 326 | XML_NotStandaloneHandler handler); |
---|
| 327 | |
---|
| 328 | void XMLPARSEAPI |
---|
| 329 | XML_SetExternalEntityRefHandler(XML_Parser parser, |
---|
| 330 | XML_ExternalEntityRefHandler handler); |
---|
| 331 | |
---|
| 332 | /* If a non-null value for arg is specified here, then it will be passed |
---|
| 333 | as the first argument to the external entity ref handler instead |
---|
| 334 | of the parser object. */ |
---|
| 335 | void XMLPARSEAPI |
---|
| 336 | XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); |
---|
| 337 | |
---|
| 338 | void XMLPARSEAPI |
---|
| 339 | XML_SetUnknownEncodingHandler(XML_Parser parser, |
---|
| 340 | XML_UnknownEncodingHandler handler, |
---|
| 341 | void *encodingHandlerData); |
---|
| 342 | |
---|
| 343 | /* This can be called within a handler for a start element, end element, |
---|
| 344 | processing instruction or character data. It causes the corresponding |
---|
| 345 | markup to be passed to the default handler. */ |
---|
| 346 | void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser); |
---|
| 347 | |
---|
| 348 | /* This value is passed as the userData argument to callbacks. */ |
---|
| 349 | void XMLPARSEAPI |
---|
| 350 | XML_SetUserData(XML_Parser parser, void *userData); |
---|
| 351 | |
---|
| 352 | /* Returns the last value set by XML_SetUserData or null. */ |
---|
| 353 | #define XML_GetUserData(parser) (*(void **)(parser)) |
---|
| 354 | |
---|
| 355 | /* This is equivalent to supplying an encoding argument |
---|
| 356 | to XML_CreateParser. It must not be called after XML_Parse |
---|
| 357 | or XML_ParseBuffer. */ |
---|
| 358 | |
---|
| 359 | int XMLPARSEAPI |
---|
| 360 | XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); |
---|
| 361 | |
---|
| 362 | /* If this function is called, then the parser will be passed |
---|
| 363 | as the first argument to callbacks instead of userData. |
---|
| 364 | The userData will still be accessible using XML_GetUserData. */ |
---|
| 365 | |
---|
| 366 | void XMLPARSEAPI |
---|
| 367 | XML_UseParserAsHandlerArg(XML_Parser parser); |
---|
| 368 | |
---|
| 369 | /* Sets the base to be used for resolving relative URIs in system identifiers in |
---|
| 370 | declarations. Resolving relative identifiers is left to the application: |
---|
| 371 | this value will be passed through as the base argument to the |
---|
| 372 | XML_ExternalEntityRefHandler, XML_NotationDeclHandler |
---|
| 373 | and XML_UnparsedEntityDeclHandler. The base argument will be copied. |
---|
| 374 | Returns zero if out of memory, non-zero otherwise. */ |
---|
| 375 | |
---|
| 376 | int XMLPARSEAPI |
---|
| 377 | XML_SetBase(XML_Parser parser, const XML_Char *base); |
---|
| 378 | |
---|
| 379 | const XML_Char XMLPARSEAPI * |
---|
| 380 | XML_GetBase(XML_Parser parser); |
---|
| 381 | |
---|
| 382 | /* Returns the number of the attributes passed in last call to the |
---|
| 383 | XML_StartElementHandler that were specified in the start-tag rather |
---|
| 384 | than defaulted. */ |
---|
| 385 | |
---|
| 386 | int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser); |
---|
| 387 | |
---|
| 388 | /* Parses some input. Returns 0 if a fatal error is detected. |
---|
| 389 | The last call to XML_Parse must have isFinal true; |
---|
| 390 | len may be zero for this call (or any other). */ |
---|
| 391 | int XMLPARSEAPI |
---|
| 392 | XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); |
---|
| 393 | |
---|
| 394 | /* Creates an XML_Parser object that can parse an external general entity; |
---|
| 395 | context is a '\0'-terminated string specifying the parse context; |
---|
| 396 | encoding is a '\0'-terminated string giving the name of the externally specified encoding, |
---|
| 397 | or null if there is no externally specified encoding. |
---|
| 398 | The context string consists of a sequence of tokens separated by formfeeds (\f); |
---|
| 399 | a token consisting of a name specifies that the general entity of the name |
---|
| 400 | is open; a token of the form prefix=uri specifies the namespace for a particular |
---|
| 401 | prefix; a token of the form =uri specifies the default namespace. |
---|
| 402 | This can be called at any point after the first call to an ExternalEntityRefHandler |
---|
| 403 | so longer as the parser has not yet been freed. |
---|
| 404 | The new parser is completely independent and may safely be used in a separate thread. |
---|
| 405 | The handlers and userData are initialized from the parser argument. |
---|
| 406 | Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */ |
---|
| 407 | XML_Parser XMLPARSEAPI |
---|
| 408 | XML_ExternalEntityParserCreate(XML_Parser parser, |
---|
| 409 | const XML_Char *context, |
---|
| 410 | const XML_Char *encoding); |
---|
| 411 | |
---|
| 412 | enum XML_Error { |
---|
| 413 | XML_ERROR_NONE, |
---|
| 414 | XML_ERROR_NO_MEMORY, |
---|
| 415 | XML_ERROR_SYNTAX, |
---|
| 416 | XML_ERROR_NO_ELEMENTS, |
---|
| 417 | XML_ERROR_INVALID_TOKEN, |
---|
| 418 | XML_ERROR_UNCLOSED_TOKEN, |
---|
| 419 | XML_ERROR_PARTIAL_CHAR, |
---|
| 420 | XML_ERROR_TAG_MISMATCH, |
---|
| 421 | XML_ERROR_DUPLICATE_ATTRIBUTE, |
---|
| 422 | XML_ERROR_JUNK_AFTER_DOC_ELEMENT, |
---|
| 423 | XML_ERROR_PARAM_ENTITY_REF, |
---|
| 424 | XML_ERROR_UNDEFINED_ENTITY, |
---|
| 425 | XML_ERROR_RECURSIVE_ENTITY_REF, |
---|
| 426 | XML_ERROR_ASYNC_ENTITY, |
---|
| 427 | XML_ERROR_BAD_CHAR_REF, |
---|
| 428 | XML_ERROR_BINARY_ENTITY_REF, |
---|
| 429 | XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, |
---|
| 430 | XML_ERROR_MISPLACED_XML_PI, |
---|
| 431 | XML_ERROR_UNKNOWN_ENCODING, |
---|
| 432 | XML_ERROR_INCORRECT_ENCODING, |
---|
| 433 | XML_ERROR_UNCLOSED_CDATA_SECTION, |
---|
| 434 | XML_ERROR_EXTERNAL_ENTITY_HANDLING, |
---|
| 435 | XML_ERROR_NOT_STANDALONE |
---|
| 436 | }; |
---|
| 437 | |
---|
| 438 | /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode |
---|
| 439 | returns information about the error. */ |
---|
| 440 | |
---|
| 441 | enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser); |
---|
| 442 | |
---|
| 443 | /* These functions return information about the current parse location. |
---|
| 444 | They may be called when XML_Parse or XML_ParseBuffer return 0; |
---|
| 445 | in this case the location is the location of the character at which |
---|
| 446 | the error was detected. |
---|
| 447 | They may also be called from any other callback called to report |
---|
| 448 | some parse event; in this the location is the location of the first |
---|
| 449 | of the sequence of characters that generated the event. */ |
---|
| 450 | |
---|
| 451 | int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); |
---|
| 452 | int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); |
---|
| 453 | long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); |
---|
| 454 | |
---|
| 455 | /* Return the number of bytes in the current event. |
---|
| 456 | Returns 0 if the event is in an internal entity. */ |
---|
| 457 | |
---|
| 458 | int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser); |
---|
| 459 | |
---|
| 460 | /* For backwards compatibility with previous versions. */ |
---|
| 461 | #define XML_GetErrorLineNumber XML_GetCurrentLineNumber |
---|
| 462 | #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber |
---|
| 463 | #define XML_GetErrorByteIndex XML_GetCurrentByteIndex |
---|
| 464 | |
---|
| 465 | /* Frees memory used by the parser. */ |
---|
| 466 | void XMLPARSEAPI |
---|
| 467 | XML_ParserFree(XML_Parser parser); |
---|
| 468 | |
---|
| 469 | /* Returns a string describing the error. */ |
---|
| 470 | const XML_LChar XMLPARSEAPI *XML_ErrorString(int code); |
---|
| 471 | |
---|
| 472 | #ifdef __cplusplus |
---|
| 473 | } |
---|
| 474 | #endif |
---|
| 475 | |
---|
| 476 | #endif /* not XmlParse_INCLUDED */ |
---|