Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmexpat / expat.h
blob86e58a1e53f78f87e5a6dea3f159b29a04198e4c
1 #include "cm_expat_mangle.h"
2 /*
3 Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
4 See the file COPYING for copying permission.
5 */
7 #ifndef XmlParse_INCLUDED
8 #define XmlParse_INCLUDED 1
10 #include <stdlib.h>
12 #include <cmexpat/expatDllConfig.h>
14 #if defined(_WIN32) && !defined(CM_EXPAT_STATIC)
15 # if defined(cmexpat_EXPORTS)
16 # define XMLPARSEAPI(type) __declspec( dllexport ) type __cdecl
17 # else
18 # define XMLPARSEAPI(type) __declspec( dllimport ) type __cdecl
19 # endif
20 #else
21 # define XMLPARSEAPI(type) type
22 #endif
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 typedef void *XML_Parser;
30 /* Information is UTF-8 encoded. */
31 typedef char XML_Char;
32 typedef char XML_LChar;
34 enum XML_Content_Type {
35 XML_CTYPE_EMPTY = 1,
36 XML_CTYPE_ANY,
37 XML_CTYPE_MIXED,
38 XML_CTYPE_NAME,
39 XML_CTYPE_CHOICE,
40 XML_CTYPE_SEQ
43 enum XML_Content_Quant {
44 XML_CQUANT_NONE,
45 XML_CQUANT_OPT,
46 XML_CQUANT_REP,
47 XML_CQUANT_PLUS
50 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
51 XML_CQUANT_NONE, and the other fields will be zero or NULL.
52 If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
53 numchildren will contain number of elements that may be mixed in
54 and children point to an array of XML_Content cells that will be
55 all of XML_CTYPE_NAME type with no quantification.
57 If type == XML_CTYPE_NAME, then the name points to the name, and
58 the numchildren field will be zero and children will be NULL. The
59 quant fields indicates any quantifiers placed on the name.
61 CHOICE and SEQ will have name NULL, the number of children in
62 numchildren and children will point, recursively, to an array
63 of XML_Content cells.
65 The EMPTY, ANY, and MIXED types will only occur at top level.
68 typedef struct XML_cp XML_Content;
70 struct XML_cp {
71 enum XML_Content_Type type;
72 enum XML_Content_Quant quant;
73 XML_Char * name;
74 unsigned int numchildren;
75 XML_Content * children;
79 /* This is called for an element declaration. See above for
80 description of the model argument. It's the caller's responsibility
81 to free model when finished with it.
84 typedef void (*XML_ElementDeclHandler) (void *userData,
85 const XML_Char *name,
86 XML_Content *model);
88 XMLPARSEAPI(void)
89 XML_SetElementDeclHandler(XML_Parser parser,
90 XML_ElementDeclHandler eldecl);
93 The Attlist declaration handler is called for *each* attribute. So
94 a single Attlist declaration with multiple attributes declared will
95 generate multiple calls to this handler. The "default" parameter
96 may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword.
97 The "isrequired" parameter will be true and the default value will
98 be NULL in the case of "#REQUIRED". If "isrequired" is true and
99 default is non-NULL, then this is a "#FIXED" default.
102 typedef void (*XML_AttlistDeclHandler) (void *userData,
103 const XML_Char *elname,
104 const XML_Char *attname,
105 const XML_Char *att_type,
106 const XML_Char *dflt,
107 int isrequired);
109 XMLPARSEAPI(void)
110 XML_SetAttlistDeclHandler(XML_Parser parser,
111 XML_AttlistDeclHandler attdecl);
114 /* The XML declaration handler is called for *both* XML declarations and
115 text declarations. The way to distinguish is that the version parameter
116 will be null for text declarations. The encoding parameter may be null
117 for XML declarations. The standalone parameter will be -1, 0, or 1
118 indicating respectively that there was no standalone parameter in
119 the declaration, that it was given as no, or that it was given as yes.
122 typedef void (*XML_XmlDeclHandler) (void *userData,
123 const XML_Char *version,
124 const XML_Char *encoding,
125 int standalone);
127 XMLPARSEAPI(void)
128 XML_SetXmlDeclHandler(XML_Parser parser,
129 XML_XmlDeclHandler xmldecl);
132 typedef struct {
133 void *(*malloc_fcn)(size_t size);
134 void *(*realloc_fcn)(void *ptr, size_t size);
135 void (*free_fcn)(void *ptr);
136 } XML_Memory_Handling_Suite;
138 /* Constructs a new parser; encoding is the encoding specified by the
139 external protocol or null if there is none specified. */
141 XMLPARSEAPI(XML_Parser)
142 XML_ParserCreate(const XML_Char *encoding);
144 /* Constructs a new parser and namespace processor. Element type
145 names and attribute names that belong to a namespace will be expanded;
146 unprefixed attribute names are never expanded; unprefixed element type
147 names are expanded only if there is a default namespace. The expanded
148 name is the concatenation of the namespace URI, the namespace
149 separator character, and the local part of the name. If the namespace
150 separator is '\0' then the namespace URI and the local part will be
151 concatenated without any separator. When a namespace is not declared,
152 the name and prefix will be passed through without expansion. */
154 XMLPARSEAPI(XML_Parser)
155 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
158 /* Constructs a new parser using the memory management suit referred to
159 by memsuite. If memsuite is NULL, then use the standard library memory
160 suite. If namespaceSeparator is non-NULL it creates a parser with
161 namespace processing as described above. The character pointed at
162 will serve as the namespace separator.
164 All further memory operations used for the created parser will come from
165 the given suite.
168 XMLPARSEAPI(XML_Parser)
169 XML_ParserCreate_MM(const XML_Char *encoding,
170 const XML_Memory_Handling_Suite *memsuite,
171 const XML_Char *namespaceSeparator);
173 /* atts is array of name/value pairs, terminated by 0;
174 names and values are 0 terminated. */
176 typedef void (*XML_StartElementHandler)(void *userData,
177 const XML_Char *name,
178 const XML_Char **atts);
180 typedef void (*XML_EndElementHandler)(void *userData,
181 const XML_Char *name);
184 /* s is not 0 terminated. */
185 typedef void (*XML_CharacterDataHandler)(void *userData,
186 const XML_Char *s,
187 int len);
189 /* target and data are 0 terminated */
190 typedef void (*XML_ProcessingInstructionHandler)(void *userData,
191 const XML_Char *target,
192 const XML_Char *data);
194 /* data is 0 terminated */
195 typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
197 typedef void (*XML_StartCdataSectionHandler)(void *userData);
198 typedef void (*XML_EndCdataSectionHandler)(void *userData);
200 /* This is called for any characters in the XML document for
201 which there is no applicable handler. This includes both
202 characters that are part of markup which is of a kind that is
203 not reported (comments, markup declarations), or characters
204 that are part of a construct which could be reported but
205 for which no handler has been supplied. The characters are passed
206 exactly as they were in the XML document except that
207 they will be encoded in UTF-8. Line boundaries are not normalized.
208 Note that a byte order mark character is not passed to the default handler.
209 There are no guarantees about how characters are divided between calls
210 to the default handler: for example, a comment might be split between
211 multiple calls. */
213 typedef void (*XML_DefaultHandler)(void *userData,
214 const XML_Char *s,
215 int len);
217 /* This is called for the start of the DOCTYPE declaration, before
218 any DTD or internal subset is parsed. */
220 typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
221 const XML_Char *doctypeName,
222 const XML_Char *sysid,
223 const XML_Char *pubid,
224 int has_internal_subset);
226 /* This is called for the start of the DOCTYPE declaration when the
227 closing > is encountered, but after processing any external subset. */
228 typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
230 /* This is called for entity declarations. The is_parameter_entity
231 argument will be non-zero if the entity is a parameter entity, zero
232 otherwise.
234 For internal entities (<!ENTITY foo "bar">), value will
235 be non-null and systemId, publicID, and notationName will be null.
236 The value string is NOT null terminated; the length is provided in
237 the value_length argument. Since it is legal to have zero-length
238 values, do not use this argument to test for internal entities.
240 For external entities, value will be null and systemId will be non-null.
241 The publicId argument will be null unless a public identifier was
242 provided. The notationName argument will have a non-null value only
243 for unparsed entity declarations.
246 typedef void (*XML_EntityDeclHandler) (void *userData,
247 const XML_Char *entityName,
248 int is_parameter_entity,
249 const XML_Char *value,
250 int value_length,
251 const XML_Char *base,
252 const XML_Char *systemId,
253 const XML_Char *publicId,
254 const XML_Char *notationName);
256 XMLPARSEAPI(void)
257 XML_SetEntityDeclHandler(XML_Parser parser,
258 XML_EntityDeclHandler handler);
260 /* OBSOLETE -- OBSOLETE -- OBSOLETE
261 This handler has been superceded by the EntityDeclHandler above.
262 It is provided here for backward compatibility.
263 This is called for a declaration of an unparsed (NDATA)
264 entity. The base argument is whatever was set by XML_SetBase.
265 The entityName, systemId and notationName arguments will never be null.
266 The other arguments may be. */
268 typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
269 const XML_Char *entityName,
270 const XML_Char *base,
271 const XML_Char *systemId,
272 const XML_Char *publicId,
273 const XML_Char *notationName);
275 /* This is called for a declaration of notation.
276 The base argument is whatever was set by XML_SetBase.
277 The notationName will never be null. The other arguments can be. */
279 typedef void (*XML_NotationDeclHandler)(void *userData,
280 const XML_Char *notationName,
281 const XML_Char *base,
282 const XML_Char *systemId,
283 const XML_Char *publicId);
285 /* When namespace processing is enabled, these are called once for
286 each namespace declaration. The call to the start and end element
287 handlers occur between the calls to the start and end namespace
288 declaration handlers. For an xmlns attribute, prefix will be null.
289 For an xmlns="" attribute, uri will be null. */
291 typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
292 const XML_Char *prefix,
293 const XML_Char *uri);
295 typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
296 const XML_Char *prefix);
298 /* This is called if the document is not standalone (it has an
299 external subset or a reference to a parameter entity, but does not
300 have standalone="yes"). If this handler returns 0, then processing
301 will not continue, and the parser will return a
302 XML_ERROR_NOT_STANDALONE error. */
304 typedef int (*XML_NotStandaloneHandler)(void *userData);
306 /* This is called for a reference to an external parsed general entity.
307 The referenced entity is not automatically parsed.
308 The application can parse it immediately or later using
309 XML_ExternalEntityParserCreate.
310 The parser argument is the parser parsing the entity containing the reference;
311 it can be passed as the parser argument to XML_ExternalEntityParserCreate.
312 The systemId argument is the system identifier as specified in the entity
313 declaration; it will not be null.
314 The base argument is the system identifier that should be used as the base for
315 resolving systemId if systemId was relative; this is set by XML_SetBase;
316 it may be null.
317 The publicId argument is the public identifier as specified in the entity
318 declaration, or null if none was specified; the whitespace in the public
319 identifier will have been normalized as required by the XML spec.
320 The context argument specifies the parsing context in the format
321 expected by the context argument to
322 XML_ExternalEntityParserCreate; context is valid only until the handler
323 returns, so if the referenced entity is to be parsed later, it must be copied.
324 The handler should return 0 if processing should not continue because of
325 a fatal error in the handling of the external entity.
326 In this case the calling parser will return an
327 XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
328 Note that unlike other handlers the first argument is the parser, not
329 userData. */
331 typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
332 const XML_Char *context,
333 const XML_Char *base,
334 const XML_Char *systemId,
335 const XML_Char *publicId);
337 /* This structure is filled in by the XML_UnknownEncodingHandler
338 to provide information to the parser about encodings that are unknown
339 to the parser.
340 The map[b] member gives information about byte sequences
341 whose first byte is b.
342 If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar
343 value c.
344 If map[b] is -1, then the byte sequence is malformed.
345 If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
346 sequence that encodes a single Unicode scalar value.
347 The data member will be passed as the first argument to the convert function.
348 The convert function is used to convert multibyte sequences;
349 s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
350 The convert function must return the Unicode scalar value
351 represented by this byte sequence or -1 if the byte sequence is malformed.
352 The convert function may be null if the encoding is a single-byte encoding,
353 that is if map[b] >= -1 for all bytes b.
354 When the parser is finished with the encoding, then if release is not null,
355 it will call release passing it the data member;
356 once release has been called, the convert function will not be called again.
358 Expat places certain restrictions on the encodings that are supported
359 using this mechanism.
361 1. Every ASCII character that can appear in a well-formed XML document,
362 other than the characters
364 $@\^`{}~
366 must be represented by a single byte, and that byte must be the
367 same byte that represents that character in ASCII.
369 2. No character may require more than 4 bytes to encode.
371 3. All characters encoded must have Unicode scalar values <= 0xFFFF, (i.e.,
372 characters that would be encoded by surrogates in UTF-16 are not
373 allowed). Note that this restriction doesn't apply to the built-in
374 support for UTF-8 and UTF-16.
376 4. No Unicode character may be encoded by more than one distinct sequence
377 of bytes. */
379 typedef struct {
380 int map[256];
381 void *data;
382 int (*convert)(void *data, const char *s);
383 void (*release)(void *data);
384 } XML_Encoding;
386 /* This is called for an encoding that is unknown to the parser.
387 The encodingHandlerData argument is that which was passed as the
388 second argument to XML_SetUnknownEncodingHandler.
389 The name argument gives the name of the encoding as specified in
390 the encoding declaration.
391 If the callback can provide information about the encoding,
392 it must fill in the XML_Encoding structure, and return 1.
393 Otherwise it must return 0.
394 If info does not describe a suitable encoding,
395 then the parser will return an XML_UNKNOWN_ENCODING error. */
397 typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
398 const XML_Char *name,
399 XML_Encoding *info);
401 XMLPARSEAPI(void)
402 XML_SetElementHandler(XML_Parser parser,
403 XML_StartElementHandler start,
404 XML_EndElementHandler end);
406 XMLPARSEAPI(void)
407 XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
409 XMLPARSEAPI(void)
410 XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
412 XMLPARSEAPI(void)
413 XML_SetCharacterDataHandler(XML_Parser parser,
414 XML_CharacterDataHandler handler);
416 XMLPARSEAPI(void)
417 XML_SetProcessingInstructionHandler(XML_Parser parser,
418 XML_ProcessingInstructionHandler handler);
419 XMLPARSEAPI(void)
420 XML_SetCommentHandler(XML_Parser parser,
421 XML_CommentHandler handler);
423 XMLPARSEAPI(void)
424 XML_SetCdataSectionHandler(XML_Parser parser,
425 XML_StartCdataSectionHandler start,
426 XML_EndCdataSectionHandler end);
428 XMLPARSEAPI(void)
429 XML_SetStartCdataSectionHandler(XML_Parser parser,
430 XML_StartCdataSectionHandler start);
432 XMLPARSEAPI(void)
433 XML_SetEndCdataSectionHandler(XML_Parser parser,
434 XML_EndCdataSectionHandler end);
436 /* This sets the default handler and also inhibits expansion of
437 internal entities. The entity reference will be passed to the default
438 handler. */
440 XMLPARSEAPI(void)
441 XML_SetDefaultHandler(XML_Parser parser,
442 XML_DefaultHandler handler);
444 /* This sets the default handler but does not inhibit expansion of
445 internal entities. The entity reference will not be passed to the
446 default handler. */
448 XMLPARSEAPI(void)
449 XML_SetDefaultHandlerExpand(XML_Parser parser,
450 XML_DefaultHandler handler);
452 XMLPARSEAPI(void)
453 XML_SetDoctypeDeclHandler(XML_Parser parser,
454 XML_StartDoctypeDeclHandler start,
455 XML_EndDoctypeDeclHandler end);
457 XMLPARSEAPI(void)
458 XML_SetStartDoctypeDeclHandler(XML_Parser parser,
459 XML_StartDoctypeDeclHandler start);
461 XMLPARSEAPI(void)
462 XML_SetEndDoctypeDeclHandler(XML_Parser parser,
463 XML_EndDoctypeDeclHandler end);
465 XMLPARSEAPI(void)
466 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
467 XML_UnparsedEntityDeclHandler handler);
469 XMLPARSEAPI(void)
470 XML_SetNotationDeclHandler(XML_Parser parser,
471 XML_NotationDeclHandler handler);
473 XMLPARSEAPI(void)
474 XML_SetNamespaceDeclHandler(XML_Parser parser,
475 XML_StartNamespaceDeclHandler start,
476 XML_EndNamespaceDeclHandler end);
478 XMLPARSEAPI(void)
479 XML_SetStartNamespaceDeclHandler(XML_Parser parser,
480 XML_StartNamespaceDeclHandler start);
482 XMLPARSEAPI(void)
483 XML_SetEndNamespaceDeclHandler(XML_Parser parser,
484 XML_EndNamespaceDeclHandler end);
486 XMLPARSEAPI(void)
487 XML_SetNotStandaloneHandler(XML_Parser parser,
488 XML_NotStandaloneHandler handler);
490 XMLPARSEAPI(void)
491 XML_SetExternalEntityRefHandler(XML_Parser parser,
492 XML_ExternalEntityRefHandler handler);
494 /* If a non-null value for arg is specified here, then it will be passed
495 as the first argument to the external entity ref handler instead
496 of the parser object. */
497 XMLPARSEAPI(void)
498 XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
500 XMLPARSEAPI(void)
501 XML_SetUnknownEncodingHandler(XML_Parser parser,
502 XML_UnknownEncodingHandler handler,
503 void *encodingHandlerData);
505 /* This can be called within a handler for a start element, end element,
506 processing instruction or character data. It causes the corresponding
507 markup to be passed to the default handler. */
508 XMLPARSEAPI(void)
509 XML_DefaultCurrent(XML_Parser parser);
511 /* If do_nst is non-zero, and namespace processing is in effect, and
512 a name has a prefix (i.e. an explicit namespace qualifier) then
513 that name is returned as a triplet in a single
514 string separated by the separator character specified when the parser
515 was created: URI + sep + local_name + sep + prefix.
517 If do_nst is zero, then namespace information is returned in the
518 default manner (URI + sep + local_name) whether or not the names
519 has a prefix.
522 XMLPARSEAPI(void)
523 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
525 /* This value is passed as the userData argument to callbacks. */
526 XMLPARSEAPI(void)
527 XML_SetUserData(XML_Parser parser, void *userData);
529 /* Returns the last value set by XML_SetUserData or null. */
530 #define XML_GetUserData(parser) (*(void **)(parser))
532 /* This is equivalent to supplying an encoding argument
533 to XML_ParserCreate. It must not be called after XML_Parse
534 or XML_ParseBuffer. */
536 XMLPARSEAPI(int)
537 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
539 /* If this function is called, then the parser will be passed
540 as the first argument to callbacks instead of userData.
541 The userData will still be accessible using XML_GetUserData. */
543 XMLPARSEAPI(void)
544 XML_UseParserAsHandlerArg(XML_Parser parser);
546 /* Sets the base to be used for resolving relative URIs in system
547 identifiers in declarations. Resolving relative identifiers is left
548 to the application: this value will be passed through as the base
549 argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler
550 and XML_UnparsedEntityDeclHandler. The base argument will be copied.
551 Returns zero if out of memory, non-zero otherwise. */
553 XMLPARSEAPI(int)
554 XML_SetBase(XML_Parser parser, const XML_Char *base);
556 XMLPARSEAPI(const XML_Char *)
557 XML_GetBase(XML_Parser parser);
559 /* Returns the number of the attribute/value pairs passed in last call
560 to the XML_StartElementHandler that were specified in the start-tag
561 rather than defaulted. Each attribute/value pair counts as 2; thus
562 this correspondds to an index into the atts array passed to the
563 XML_StartElementHandler. */
565 XMLPARSEAPI(int)
566 XML_GetSpecifiedAttributeCount(XML_Parser parser);
568 /* Returns the index of the ID attribute passed in the last call to
569 XML_StartElementHandler, or -1 if there is no ID attribute. Each
570 attribute/value pair counts as 2; thus this correspondds to an index
571 into the atts array passed to the XML_StartElementHandler. */
573 XMLPARSEAPI(int)
574 XML_GetIdAttributeIndex(XML_Parser parser);
576 /* Parses some input. Returns 0 if a fatal error is detected.
577 The last call to XML_Parse must have isFinal true;
578 len may be zero for this call (or any other). */
579 XMLPARSEAPI(int)
580 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
582 XMLPARSEAPI(void *)
583 XML_GetBuffer(XML_Parser parser, int len);
585 XMLPARSEAPI(int)
586 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
588 /* Creates an XML_Parser object that can parse an external general
589 entity; context is a '\0'-terminated string specifying the parse
590 context; encoding is a '\0'-terminated string giving the name of the
591 externally specified encoding, or null if there is no externally
592 specified encoding. The context string consists of a sequence of
593 tokens separated by formfeeds (\f); a token consisting of a name
594 specifies that the general entity of the name is open; a token of the
595 form prefix=uri specifies the namespace for a particular prefix; a
596 token of the form =uri specifies the default namespace. This can be
597 called at any point after the first call to an
598 ExternalEntityRefHandler so longer as the parser has not yet been
599 freed. The new parser is completely independent and may safely be
600 used in a separate thread. The handlers and userData are initialized
601 from the parser argument. Returns 0 if out of memory. Otherwise
602 returns a new XML_Parser object. */
603 XMLPARSEAPI(XML_Parser)
604 XML_ExternalEntityParserCreate(XML_Parser parser,
605 const XML_Char *context,
606 const XML_Char *encoding);
608 enum XML_ParamEntityParsing {
609 XML_PARAM_ENTITY_PARSING_NEVER,
610 XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
611 XML_PARAM_ENTITY_PARSING_ALWAYS
614 /* Controls parsing of parameter entities (including the external DTD
615 subset). If parsing of parameter entities is enabled, then references
616 to external parameter entities (including the external DTD subset)
617 will be passed to the handler set with
618 XML_SetExternalEntityRefHandler. The context passed will be 0.
619 Unlike external general entities, external parameter entities can only
620 be parsed synchronously. If the external parameter entity is to be
621 parsed, it must be parsed during the call to the external entity ref
622 handler: the complete sequence of XML_ExternalEntityParserCreate,
623 XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
624 this call. After XML_ExternalEntityParserCreate has been called to
625 create the parser for the external parameter entity (context must be 0
626 for this call), it is illegal to make any calls on the old parser
627 until XML_ParserFree has been called on the newly created parser. If
628 the library has been compiled without support for parameter entity
629 parsing (ie without XML_DTD being defined), then
630 XML_SetParamEntityParsing will return 0 if parsing of parameter
631 entities is requested; otherwise it will return non-zero. */
633 XMLPARSEAPI(int)
634 XML_SetParamEntityParsing(XML_Parser parser,
635 enum XML_ParamEntityParsing parsing);
637 enum XML_Error {
638 XML_ERROR_NONE,
639 XML_ERROR_NO_MEMORY,
640 XML_ERROR_SYNTAX,
641 XML_ERROR_NO_ELEMENTS,
642 XML_ERROR_INVALID_TOKEN,
643 XML_ERROR_UNCLOSED_TOKEN,
644 XML_ERROR_PARTIAL_CHAR,
645 XML_ERROR_TAG_MISMATCH,
646 XML_ERROR_DUPLICATE_ATTRIBUTE,
647 XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
648 XML_ERROR_PARAM_ENTITY_REF,
649 XML_ERROR_UNDEFINED_ENTITY,
650 XML_ERROR_RECURSIVE_ENTITY_REF,
651 XML_ERROR_ASYNC_ENTITY,
652 XML_ERROR_BAD_CHAR_REF,
653 XML_ERROR_BINARY_ENTITY_REF,
654 XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
655 XML_ERROR_MISPLACED_XML_PI,
656 XML_ERROR_UNKNOWN_ENCODING,
657 XML_ERROR_INCORRECT_ENCODING,
658 XML_ERROR_UNCLOSED_CDATA_SECTION,
659 XML_ERROR_EXTERNAL_ENTITY_HANDLING,
660 XML_ERROR_NOT_STANDALONE,
661 XML_ERROR_UNEXPECTED_STATE
664 /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
665 returns information about the error. */
667 XMLPARSEAPI(enum XML_Error)
668 XML_GetErrorCode(XML_Parser parser);
670 /* These functions return information about the current parse location.
671 They may be called when XML_Parse or XML_ParseBuffer return 0;
672 in this case the location is the location of the character at which
673 the error was detected.
674 They may also be called from any other callback called to report
675 some parse event; in this the location is the location of the first
676 of the sequence of characters that generated the event. */
678 XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
679 XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
680 XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser);
682 /* Return the number of bytes in the current event.
683 Returns 0 if the event is in an internal entity. */
685 XMLPARSEAPI(int)
686 XML_GetCurrentByteCount(XML_Parser parser);
688 /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
689 the integer pointed to by offset to the offset within this buffer
690 of the current parse position, and sets the integer pointed to by size
691 to the size of this buffer (the number of input bytes). Otherwise
692 returns a null pointer. Also returns a null pointer if a parse isn't
693 active.
695 NOTE: The character pointer returned should not be used outside
696 the handler that makes the call. */
698 XMLPARSEAPI(const char *)
699 XML_GetInputContext(XML_Parser parser,
700 int *offset,
701 int *size);
703 /* For backwards compatibility with previous versions. */
704 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
705 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
706 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
708 /* Frees memory used by the parser. */
709 XMLPARSEAPI(void)
710 XML_ParserFree(XML_Parser parser);
712 /* Returns a string describing the error. */
713 XMLPARSEAPI(const XML_LChar *)
714 XML_ErrorString(int code);
716 /* Return a string containing the version number of this expat */
717 XMLPARSEAPI(const XML_LChar *)
718 XML_ExpatVersion(void);
720 typedef struct {
721 int major;
722 int minor;
723 int micro;
724 } XML_Expat_Version;
726 /* Return an XML_Expat_Version structure containing numeric version
727 number information for this version of expat */
729 XMLPARSEAPI(XML_Expat_Version)
730 XML_ExpatVersionInfo(void);
732 #define XML_MAJOR_VERSION 1
733 #define XML_MINOR_VERSION 95
734 #define XML_MICRO_VERSION 2
736 #ifdef __cplusplus
738 #endif
740 #endif /* not XmlParse_INCLUDED */