ReactOS  r76032
Go to the documentation of this file.
1 /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
2  See the file COPYING for copying permission.
3 */
5 #ifndef Expat_INCLUDED
6 #define Expat_INCLUDED 1
8 #ifdef __VMS
9 /* 0 1 2 3 0 1 2 3
10  1234567890123456789012345678901 1234567890123456789012345678901 */
11 #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
12 #define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler
13 #define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler
14 #define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg
15 #endif
17 #include <stdlib.h>
18 #include "expat_external.h"
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
24 struct XML_ParserStruct;
25 typedef struct XML_ParserStruct *XML_Parser;
27 /* Should this be defined using stdbool.h when C99 is available? */
28 typedef unsigned char XML_Bool;
29 #define XML_TRUE ((XML_Bool) 1)
30 #define XML_FALSE ((XML_Bool) 0)
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:
37  #ifndef XML_STATUS_OK
38  #define XML_STATUS_OK 1
39  #define XML_STATUS_ERROR 0
40  #endif
42  Otherwise, the #define hackery is quite ugly and would have been
43  dropped.
44 */
45 enum XML_Status {
52 };
54 enum XML_Error {
82  /* Added in 1.95.7. */
84  /* Added in 1.95.8. */
95  /* Added in 2.0. */
99 };
108 };
115 };
117 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
118  XML_CQUANT_NONE, and the other fields will be zero or NULL.
119  If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
120  numchildren will contain number of elements that may be mixed in
121  and children point to an array of XML_Content cells that will be
122  all of XML_CTYPE_NAME type with no quantification.
124  If type == XML_CTYPE_NAME, then the name points to the name, and
125  the numchildren field will be zero and children will be NULL. The
126  quant fields indicates any quantifiers placed on the name.
128  CHOICE and SEQ will have name NULL, the number of children in
129  numchildren and children will point, recursively, to an array
130  of XML_Content cells.
132  The EMPTY, ANY, and MIXED types will only occur at top level.
133 */
135 typedef struct XML_cp XML_Content;
137 struct XML_cp {
141  unsigned int numchildren;
143 };
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 */
150 typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,
151  const XML_Char *name,
152  XML_Content *model);
156  XML_ElementDeclHandler eldecl);
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 */
166 typedef void (XMLCALL *XML_AttlistDeclHandler) (
167  void *userData,
172  int isrequired);
175 XML_SetAttlistDeclHandler(XML_Parser parser,
176  XML_AttlistDeclHandler attdecl);
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 */
186 typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData,
189  int standalone);
192 XML_SetXmlDeclHandler(XML_Parser parser,
193  XML_XmlDeclHandler xmldecl);
196 typedef struct {
197  void *(*malloc_fcn)(size_t size);
198  void *(*realloc_fcn)(void *ptr, size_t size);
199  void (*free_fcn)(void *ptr);
202 /* Constructs a new parser; encoding is the encoding specified by the
203  external protocol or NULL if there is none specified.
204 */
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.
216  It is a programming error to use the separator '\0' with namespace
217  triplets (see XML_SetReturnNSTriplet).
218 */
220 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
223 /* Constructs a new parser using the memory management suite referred to
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.
229  All further memory operations used for the created parser will come from
230  the given suite.
231 */
235  const XML_Char *namespaceSeparator);
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.
240  All handlers are cleared from the parser, except for the
241  unknownEncodingHandler. The parser's external state is re-initialized
242  except for the values of ns and ns_triplets.
244  Added in Expat 1.95.3.
245 */
247 XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
249 /* atts is array of name/value pairs, terminated by 0;
250  names and values are 0 terminated.
251 */
252 typedef void (XMLCALL *XML_StartElementHandler) (void *userData,
254  const XML_Char **atts);
256 typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
257  const XML_Char *name);
260 /* s is not 0 terminated. */
261 typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,
263  int len);
265 /* target and data are 0 terminated */
266 typedef void (XMLCALL *XML_ProcessingInstructionHandler) (
267  void *userData,
269  const XML_Char *data);
271 /* data is 0 terminated */
272 typedef void (XMLCALL *XML_CommentHandler) (void *userData,
273  const XML_Char *data);
275 typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData);
276 typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
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
284  document except that they will be encoded in UTF-8 or UTF-16.
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 */
291 typedef void (XMLCALL *XML_DefaultHandler) (void *userData,
292  const XML_Char *s,
293  int len);
295 /* This is called for the start of the DOCTYPE declaration, before
296  any DTD or internal subset is parsed.
297 */
298 typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
299  void *userData,
303  int has_internal_subset);
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 */
309 typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
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.
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.
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.
326  Note that is_parameter_entity can't be changed to XML_Bool, since
327  that would break binary compatibility.
328 */
329 typedef void (XMLCALL *XML_EntityDeclHandler) (
330  void *userData,
334  int value_length,
341 XML_SetEntityDeclHandler(XML_Parser parser,
342  XML_EntityDeclHandler handler);
345  This handler has been superceded by the EntityDeclHandler above.
346  It is provided here for backward compatibility.
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 */
353 typedef 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);
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 */
365 typedef 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);
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 */
378 typedef void (XMLCALL *XML_StartNamespaceDeclHandler) (
379  void *userData,
381  const XML_Char *uri);
383 typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
384  void *userData,
385  const XML_Char *prefix);
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
389  have standalone="yes". If this handler returns XML_STATUS_ERROR,
390  then processing will not continue, and the parser will return a
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 */
396 typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
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.
403  The parser argument is the parser parsing the entity containing the
404  reference; it can be passed as the parser argument to
405  XML_ExternalEntityParserCreate. The systemId argument is the
406  system identifier as specified in the entity declaration; it will
407  not be NULL.
409  The base argument is the system identifier that should be used as
410  the base for resolving systemId if systemId was relative; this is
411  set by XML_SetBase; it may be NULL.
413  The publicId argument is the public identifier as specified in the
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.
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.
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
429  Note that unlike other handlers the first argument is the parser,
430  not userData.
431 */
432 typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
433  XML_Parser parser,
435  const XML_Char *base,
436  const XML_Char *systemId,
437  const XML_Char *publicId);
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 */
449 typedef void (XMLCALL *XML_SkippedEntityHandler) (
450  void *userData,
451  const XML_Char *entityName,
452  int is_parameter_entity);
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.
458  The map[b] member gives information about byte sequences whose
459  first byte is b.
461  If map[b] is c where c is >= 0, then b by itself encodes the
462  Unicode scalar value c.
464  If map[b] is -1, then the byte sequence is malformed.
466  If map[b] is -n, where n >= 2, then b is the first byte of an
467  n-byte sequence that encodes a single Unicode scalar value.
469  The data member will be passed as the first argument to the convert
470  function.
472  The convert function is used to convert multibyte sequences; s will
473  point to a n-byte sequence where map[(unsigned char)*s] == -n. The
474  convert function must return the Unicode scalar value represented
475  by this byte sequence or -1 if the byte sequence is malformed.
477  The convert function may be NULL if the encoding is a single-byte
478  encoding, that is if map[b] >= -1 for all bytes b.
480  When the parser is finished with the encoding, then if release is
481  not NULL, it will call release passing it the data member; once
482  release has been called, the convert function will not be called
483  again.
485  Expat places certain restrictions on the encodings that are supported
486  using this mechanism.
488  1. Every ASCII character that can appear in a well-formed XML document,
489  other than the characters
491  $@\^`{}~
493  must be represented by a single byte, and that byte must be the
494  same byte that represents that character in ASCII.
496  2. No character may require more than 4 bytes to encode.
498  3. All characters encoded must have Unicode scalar values <=
499  0xFFFF, (i.e., characters that would be encoded by surrogates in
500  UTF-16 are not allowed). Note that this restriction doesn't
501  apply to the built-in support for UTF-8 and UTF-16.
503  4. No Unicode character may be encoded by more than one distinct
504  sequence of bytes.
505 */
506 typedef struct {
507  int map[256];
508  void *data;
509  int (XMLCALL *convert)(void *data, const char *s);
510  void (XMLCALL *release)(void *data);
511 } XML_Encoding;
513 /* This is called for an encoding that is unknown to the parser.
515  The encodingHandlerData argument is that which was passed as the
516  second argument to XML_SetUnknownEncodingHandler.
518  The name argument gives the name of the encoding as specified in
519  the encoding declaration.
521  If the callback can provide information about the encoding, it must
522  fill in the XML_Encoding structure, and return XML_STATUS_OK.
523  Otherwise it must return XML_STATUS_ERROR.
525  If info does not describe a suitable encoding, then the parser will
526  return an XML_UNKNOWN_ENCODING error.
527 */
528 typedef int (XMLCALL *XML_UnknownEncodingHandler) (
529  void *encodingHandlerData,
530  const XML_Char *name,
531  XML_Encoding *info);
534 XML_SetElementHandler(XML_Parser parser,
535  XML_StartElementHandler start,
536  XML_EndElementHandler end);
539 XML_SetStartElementHandler(XML_Parser parser,
540  XML_StartElementHandler handler);
543 XML_SetEndElementHandler(XML_Parser parser,
544  XML_EndElementHandler handler);
547 XML_SetCharacterDataHandler(XML_Parser parser,
548  XML_CharacterDataHandler handler);
551 XML_SetProcessingInstructionHandler(XML_Parser parser,
552  XML_ProcessingInstructionHandler handler);
554 XML_SetCommentHandler(XML_Parser parser,
555  XML_CommentHandler handler);
558 XML_SetCdataSectionHandler(XML_Parser parser,
559  XML_StartCdataSectionHandler start,
560  XML_EndCdataSectionHandler end);
563 XML_SetStartCdataSectionHandler(XML_Parser parser,
564  XML_StartCdataSectionHandler start);
567 XML_SetEndCdataSectionHandler(XML_Parser parser,
568  XML_EndCdataSectionHandler end);
570 /* This sets the default handler and also inhibits expansion of
571  internal entities. These entity references will be passed to the
572  default handler, or to the skipped entity handler, if one is set.
573 */
575 XML_SetDefaultHandler(XML_Parser parser,
576  XML_DefaultHandler handler);
578 /* This sets the default handler but does not inhibit expansion of
579  internal entities. The entity reference will not be passed to the
580  default handler.
581 */
583 XML_SetDefaultHandlerExpand(XML_Parser parser,
584  XML_DefaultHandler handler);
587 XML_SetDoctypeDeclHandler(XML_Parser parser,
588  XML_StartDoctypeDeclHandler start,
592 XML_SetStartDoctypeDeclHandler(XML_Parser parser,
593  XML_StartDoctypeDeclHandler start);
596 XML_SetEndDoctypeDeclHandler(XML_Parser parser,
600 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
601  XML_UnparsedEntityDeclHandler handler);
604 XML_SetNotationDeclHandler(XML_Parser parser,
605  XML_NotationDeclHandler handler);
608 XML_SetNamespaceDeclHandler(XML_Parser parser,
609  XML_StartNamespaceDeclHandler start,
610  XML_EndNamespaceDeclHandler end);
613 XML_SetStartNamespaceDeclHandler(XML_Parser parser,
614  XML_StartNamespaceDeclHandler start);
617 XML_SetEndNamespaceDeclHandler(XML_Parser parser,
618  XML_EndNamespaceDeclHandler end);
621 XML_SetNotStandaloneHandler(XML_Parser parser,
622  XML_NotStandaloneHandler handler);
625 XML_SetExternalEntityRefHandler(XML_Parser parser,
626  XML_ExternalEntityRefHandler handler);
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 */
633 XML_SetExternalEntityRefHandlerArg(XML_Parser parser,
634  void *arg);
637 XML_SetSkippedEntityHandler(XML_Parser parser,
638  XML_SkippedEntityHandler handler);
641 XML_SetUnknownEncodingHandler(XML_Parser parser,
642  XML_UnknownEncodingHandler handler,
643  void *encodingHandlerData);
645 /* This can be called within a handler for a start element, end
646  element, processing instruction or character data. It causes the
647  corresponding markup to be passed to the default handler.
648 */
650 XML_DefaultCurrent(XML_Parser parser);
652 /* If do_nst is non-zero, and namespace processing is in effect, and
653  a name has a prefix (i.e. an explicit namespace qualifier) then
654  that name is returned as a triplet in a single string separated by
655  the separator character specified when the parser was created: URI
656  + sep + local_name + sep + prefix.
658  If do_nst is zero, then namespace information is returned in the
659  default manner (URI + sep + local_name) whether or not the name
660  has a prefix.
662  Note: Calling XML_SetReturnNSTriplet after XML_Parse or
663  XML_ParseBuffer has no effect.
664 */
667 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
669 /* This value is passed as the userData argument to callbacks. */
671 XML_SetUserData(XML_Parser parser, void *userData);
673 /* Returns the last value set by XML_SetUserData or NULL. */
674 #define XML_GetUserData(parser) (*(void **)(parser))
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
680  has no effect and returns XML_STATUS_ERROR.
681 */
683 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
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 */
690 XML_UseParserAsHandlerArg(XML_Parser parser);
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.
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
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
709 */
711 XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
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
719  argument will be copied. Returns XML_STATUS_ERROR if out of memory,
720  XML_STATUS_OK otherwise.
721 */
723 XML_SetBase(XML_Parser parser, const XML_Char *base);
726 XML_GetBase(XML_Parser parser);
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
731  this correspondds to an index into the atts array passed to the
732  XML_StartElementHandler.
733 */
735 XML_GetSpecifiedAttributeCount(XML_Parser parser);
737 /* Returns the index of the ID attribute passed in the last call to
738  XML_StartElementHandler, or -1 if there is no ID attribute. Each
739  attribute/value pair counts as 2; thus this correspondds to an
740  index into the atts array passed to the XML_StartElementHandler.
741 */
743 XML_GetIdAttributeIndex(XML_Parser parser);
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).
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.
753 */
755 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
757 XMLPARSEAPI(void *)
758 XML_GetBuffer(XML_Parser parser, int len);
761 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
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.
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.
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.
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.
792  When suspended, parsing can be resumed by calling XML_ResumeParser().
793 */
795 XML_StopParser(XML_Parser parser, XML_Bool resumable);
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.
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 */
810 XML_ResumeParser(XML_Parser parser);
817 };
819 typedef struct {
820  enum XML_Parsing parsing;
821  XML_Bool finalBuffer;
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,
828 */
830 XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
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
845  initialized from the parser argument. Returns NULL if out of memory.
846  Otherwise returns a new XML_Parser object.
847 */
849 XML_ExternalEntityParserCreate(XML_Parser parser,
857 };
859 /* Controls parsing of parameter entities (including the external DTD
860  subset). If parsing of parameter entities is enabled, then
861  references to external parameter entities (including the external
862  DTD subset) will be passed to the handler set with
863  XML_SetExternalEntityRefHandler. The context passed will be 0.
865  Unlike external general entities, external parameter entities can
866  only be parsed synchronously. If the external parameter entity is
867  to be parsed, it must be parsed during the call to the external
868  entity ref handler: the complete sequence of
869  XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and
870  XML_ParserFree calls must be made during this call. After
871  XML_ExternalEntityParserCreate has been called to create the parser
872  for the external parameter entity (context must be 0 for this
873  call), it is illegal to make any calls on the old parser until
874  XML_ParserFree has been called on the newly created parser.
875  If the library has been compiled without support for parameter
876  entity parsing (ie without XML_DTD being defined), then
877  XML_SetParamEntityParsing will return 0 if parsing of parameter
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 */
883 XML_SetParamEntityParsing(XML_Parser parser,
884  enum XML_ParamEntityParsing parsing);
886 /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
887  XML_GetErrorCode returns information about the error.
888 */
890 XML_GetErrorCode(XML_Parser parser);
892 /* These functions return information about the current parse
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).
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.
907 */
908 XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
909 XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
910 XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
912 /* Return the number of bytes in the current event.
913  Returns 0 if the event is in an internal entity.
914 */
916 XML_GetCurrentByteCount(XML_Parser parser);
918 /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
919  the integer pointed to by offset to the offset within this buffer
920  of the current parse position, and sets the integer pointed to by size
921  to the size of this buffer (the number of input bytes). Otherwise
922  returns a NULL pointer. Also returns a NULL pointer if a parse isn't
923  active.
925  NOTE: The character pointer returned should not be used outside
926  the handler that makes the call.
927 */
928 XMLPARSEAPI(const char *)
929 XML_GetInputContext(XML_Parser parser,
930  int *offset,
931  int *size);
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
938 /* Frees the content model passed to the element declaration handler */
940 XML_FreeContentModel(XML_Parser parser, XML_Content *model);
942 /* Exposing the memory handling functions used in Expat */
943 XMLPARSEAPI(void *)
944 XML_MemMalloc(XML_Parser parser, size_t size);
946 XMLPARSEAPI(void *)
947 XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
950 XML_MemFree(XML_Parser parser, void *ptr);
952 /* Frees memory used by the parser. */
954 XML_ParserFree(XML_Parser parser);
956 /* Returns a string describing the error. */
960 /* Return a string containing the version number of this expat */
962 XML_ExpatVersion(void);
964 typedef struct {
965  int major;
966  int minor;
967  int micro;
970 /* Return an XML_Expat_Version structure containing numeric version
971  number information for this version of expat.
972 */
976 /* Added in Expat 1.95.5. */
987  /* Additional features must be added to the end of this enum. */
988 };
990 typedef struct {
992  const XML_LChar *name;
993  long int value;
994 } XML_Feature;
996 XMLPARSEAPI(const XML_Feature *)
997 XML_GetFeatureList(void);
1000 /* Expat follows the GNU/Linux convention of odd number minor version for
1001  beta/development releases and even number minor version for stable
1002  releases. Micro is bumped with each release, and set to 0 with each
1003  change to major or minor version.
1004 */
1005 #define XML_MAJOR_VERSION 2
1006 #define XML_MINOR_VERSION 0
1007 #define XML_MICRO_VERSION 0
1009 #ifdef __cplusplus
1010 }
1011 #endif
1013 #endif /* not Expat_INCLUDED */
Definition: misc.c:1692
XML_ParserFree(XML_Parser parser)
XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator)
XML_ParserCreate(const XML_Char *encoding)
const XML_Char * version
Definition: expat.h:187
Definition: get.c:139
Definition: expat.h:853
void(XMLCALL * XML_EndDoctypeDeclHandler)(void *userData)
Definition: expat.h:309
long int value
Definition: expat.h:993
char XML_LChar
const char * s
Definition: expat.h:509
Definition: http.c:6587
const XML_Char * elname
Definition: expat.h:168
XML_GetCurrentByteCount(XML_Parser parser)
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator)
XML_DefaultCurrent(XML_Parser parser)
XML_SetUserData(XML_Parser parser, void *userData)
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size)
const XML_Char int const XML_Char int value_length
Definition: expat.h:331
const XML_Char const XML_Char ** atts
Definition: expat.h:253
const XML_Char const XML_Char * encoding
Definition: expat.h:187
XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler)
XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start)
unsigned char XML_Bool
Definition: expat.h:28
XML_ErrorString(enum XML_Error code)
XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler)
XML_GetSpecifiedAttributeCount(XML_Parser parser)
GLuint GLuint end
Definition: gl.h:1545
XML_ResumeParser(XML_Parser parser)
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding)
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
enum XML_Content_Quant quant
Definition: expat.h:139
XML_Bool finalBuffer
Definition: expat.h:821
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
const XML_Char int const XML_Char int const XML_Char const XML_Char const XML_Char const XML_Char * notationName
Definition: expat.h:331
XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData)
const XML_Char const XML_Char const XML_Char const XML_Char int isrequired
Definition: expat.h:168
struct XML_ParserStruct * XML_Parser
Definition: expat.h:25
XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status)
const XML_Char const XML_Char * sysid
Definition: expat.h:300
XML_FreeContentModel(XML_Parser parser, XML_Content *model)
const XML_Char const XML_Char * attname
Definition: expat.h:168
const XML_Char const XML_Char int standalone
Definition: expat.h:187
XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl)
static PVOID ptr
Definition: dispmode.c:30
XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start)
XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler)
XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler)
unsigned int numchildren
Definition: expat.h:141
XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser)
XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end)
XML_GetIdAttributeIndex(XML_Parser parser)
const XML_Char const XML_Char * data
Definition: expat.h:268
Definition: expat.h:101
const XML_Char const XML_Char const XML_Char const XML_Char * dflt
Definition: expat.h:168
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
enum XML_Content_Type type
Definition: expat.h:138
XML_MemMalloc(XML_Parser parser, size_t size)
XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler)
#define const
Definition: zconf.h:230
Definition: expat.h:54
XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing)
int convert
Definition: msacm.c:1362
XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler)
XML_GetBuffer(XML_Parser parser, int len)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
Definition: expat.h:49
XML_Content * children
Definition: expat.h:142
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler)
XML_StopParser(XML_Parser parser, XML_Bool resumable)
Definition: expat.h:137
Definition: _map.h:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const XML_Char const XML_Char const XML_Char int has_internal_subset
Definition: expat.h:300
XML_Char * name
Definition: expat.h:140
XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding)
XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler)
XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end)
XML_GetInputContext(XML_Parser parser, int *offset, int *size)
const XML_Char * prefix
Definition: expat.h:380
XML_UseParserAsHandlerArg(XML_Parser parser)
GLdouble s
Definition: gl.h:2039
Definition: expat.h:47
const XML_Char const XML_Char const XML_Char * att_type
Definition: expat.h:168
GLenum GLsizei len
Definition: glext.h:6722
const XML_Char int const XML_Char int const XML_Char const XML_Char * systemId
Definition: expat.h:331
const XML_Char XML_Encoding * info
Definition: expat.h:530
const XML_Char int is_parameter_entity
Definition: expat.h:331
XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler)
XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler)
XML_MemFree(XML_Parser parser, void *ptr)
Definition: expat.h:977
const XML_Char * name
Definition: expat.h:151
GLuint start
Definition: gl.h:1545
const XML_Char const XML_Char const XML_Char * pubid
Definition: expat.h:300
GLsizeiptr size
Definition: glext.h:5919
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler)
XML_SetBase(XML_Parser parser, const XML_Char *base)
XML_ParserReset(XML_Parser parser, const XML_Char *encoding)
void * data
Definition: expat.h:508
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7684
XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end)
Definition: expat.h:45
XML_GetErrorCode(XML_Parser parser)
Definition: import.c:85
#define XMLCALL
const XML_LChar * name
Definition: expat.h:992
XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end)
XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start)
Definition: expat.h:812
XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl)
unsigned long XML_Size
const XML_Char const XML_Char * uri
Definition: expat.h:380
XML_GetBase(XML_Parser parser)
const XML_Char XML_Content * model
Definition: expat.h:151
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
long XML_Index
const XML_Char * doctypeName
Definition: expat.h:300
XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end)
char XML_Char
XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler)
XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end)
Definition: expat.h:110
XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end)
GLintptr offset
Definition: glext.h:5920
XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler)
const XML_Char int const XML_Char int const XML_Char const XML_Char const XML_Char * publicId
Definition: expat.h:331
const XML_Char * entityName
Definition: expat.h:331
Definition: ps.c:97
XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl)