Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

expat.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
00003 See the file COPYING for copying permission.
00004 */
00005 
00006 #ifndef XmlParse_INCLUDED
00007 #define XmlParse_INCLUDED 1
00008 
00009 #include <stdlib.h>
00010 #include <string.h>
00011 
00012 #ifndef XMLPARSEAPI
00013 #  ifdef __declspec
00014 #    define XMLPARSEAPI __declspec(dllimport)
00015 #  else
00016 #    define XMLPARSEAPI /* nothing */
00017 #  endif
00018 #endif  /* not defined XMLPARSEAPI */
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 typedef void *XML_Parser;
00025 
00026 /* Information is UTF-8 encoded. */
00027 typedef char XML_Char;
00028 typedef char XML_LChar;
00029 
00030 enum XML_Content_Type {
00031   XML_CTYPE_EMPTY = 1,
00032   XML_CTYPE_ANY,
00033   XML_CTYPE_MIXED,
00034   XML_CTYPE_NAME,
00035   XML_CTYPE_CHOICE,
00036   XML_CTYPE_SEQ
00037 };
00038 
00039 enum XML_Content_Quant {
00040   XML_CQUANT_NONE,
00041   XML_CQUANT_OPT,
00042   XML_CQUANT_REP,
00043   XML_CQUANT_PLUS
00044 };
00045 
00046 /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
00047    XML_CQUANT_NONE, and the other fields will be zero or NULL.
00048    If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
00049    numchildren will contain number of elements that may be mixed in
00050    and children point to an array of XML_Content cells that will be
00051    all of XML_CTYPE_NAME type with no quantification.
00052 
00053    If type == XML_CTYPE_NAME, then the name points to the name, and
00054    the numchildren field will be zero and children will be NULL. The
00055    quant fields indicates any quantifiers placed on the name.
00056 
00057    CHOICE and SEQ will have name NULL, the number of children in
00058    numchildren and children will point, recursively, to an array
00059    of XML_Content cells.
00060 
00061    The EMPTY, ANY, and MIXED types will only occur at top level.
00062 */
00063 
00064 typedef struct XML_cp XML_Content;
00065 
00066 struct XML_cp {
00067   enum XML_Content_Type         type;
00068   enum XML_Content_Quant        quant;
00069   const XML_Char *              name;
00070   unsigned int                  numchildren;
00071   XML_Content *                 children;
00072 };
00073 
00074 
00075 /* This is called for an element declaration. See above for
00076    description of the model argument. It's the caller's responsibility
00077    to free model when finished with it.
00078 */
00079 
00080 typedef void (*XML_ElementDeclHandler) (void *userData,
00081                                         const XML_Char *name,
00082                                         XML_Content *model);
00083 
00084 void XMLPARSEAPI
00085 XML_SetElementDeclHandler(XML_Parser parser,
00086                           XML_ElementDeclHandler eldecl);
00087 
00088 /*
00089   The Attlist declaration handler is called for *each* attribute. So
00090   a single Attlist declaration with multiple attributes declared will
00091   generate multiple calls to this handler. The "default" parameter
00092   may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword.
00093   The "isrequired" parameter will be true and the default value will
00094   be NULL in the case of "#REQUIRED". If "isrequired" is true and
00095   default is non-NULL, then this is a "#FIXED" default.
00096  */
00097 
00098 typedef void (*XML_AttlistDeclHandler) (void            *userData,
00099                                         const XML_Char  *elname,
00100                                         const XML_Char  *attname,
00101                                         const XML_Char  *att_type,
00102                                         const XML_Char  *dflt,
00103                                         int             isrequired);
00104 
00105 void XMLPARSEAPI
00106 XML_SetAttlistDeclHandler(XML_Parser parser,
00107                           XML_AttlistDeclHandler attdecl);
00108 
00109 
00110   /* The XML declaration handler is called for *both* XML declarations and
00111      text declarations. The way to distinguish is that the version parameter
00112      will be null for text declarations. The encoding parameter may be null
00113      for XML declarations. The standalone parameter will be -1, 0, or 1
00114      indicating respectively that there was no standalone parameter in
00115      the declaration, that it was given as no, or that it was given as yes.
00116   */
00117 
00118 typedef void (*XML_XmlDeclHandler) (void                *userData,
00119                                     const XML_Char      *version,
00120                                     const XML_Char      *encoding,
00121                                     int                 standalone);
00122 
00123 void XMLPARSEAPI
00124 XML_SetXmlDeclHandler(XML_Parser parser,
00125                       XML_XmlDeclHandler xmldecl);
00126 
00127 
00128 typedef struct {
00129   void *(*malloc_fcn)(size_t size);
00130   void *(*realloc_fcn)(void *ptr, size_t size);
00131   void (*free_fcn)(void *ptr);
00132 } XML_Memory_Handling_Suite;
00133 
00134 /* Constructs a new parser; encoding is the encoding specified by the external
00135 protocol or null if there is none specified. */
00136 
00137 XML_Parser XMLPARSEAPI
00138 XML_ParserCreate(const XML_Char *encoding);
00139 
00140 /* Constructs a new parser and namespace processor.  Element type names
00141 and attribute names that belong to a namespace will be expanded;
00142 unprefixed attribute names are never expanded; unprefixed element type
00143 names are expanded only if there is a default namespace. The expanded
00144 name is the concatenation of the namespace URI, the namespace separator character,
00145 and the local part of the name.  If the namespace separator is '\0' then
00146 the namespace URI and the local part will be concatenated without any
00147 separator.  When a namespace is not declared, the name and prefix will be
00148 passed through without expansion. */
00149 
00150 XML_Parser XMLPARSEAPI
00151 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
00152 
00153 
00154 /* Constructs a new parser using the memory management suit referred to
00155    by memsuite. If memsuite is NULL, then use the standard library memory
00156    suite. If namespaceSeparator is non-NULL it creates a parser with
00157    namespace processing as described above. The character pointed at
00158    will serve as the namespace separator.
00159 
00160    All further memory operations used for the created parser will come from
00161    the given suite.
00162 */
00163 
00164 XML_Parser XMLPARSEAPI
00165 XML_ParserCreate_MM(const XML_Char *encoding,
00166                     const XML_Memory_Handling_Suite *memsuite,
00167                     const XML_Char *namespaceSeparator);
00168 
00169 /* atts is array of name/value pairs, terminated by 0;
00170    names and values are 0 terminated. */
00171 
00172 typedef void (*XML_StartElementHandler)(void *userData,
00173                                         const XML_Char *name,
00174                                         const XML_Char **atts);
00175 
00176 typedef void (*XML_EndElementHandler)(void *userData,
00177                                       const XML_Char *name);
00178 
00179 
00180 /* s is not 0 terminated. */
00181 typedef void (*XML_CharacterDataHandler)(void *userData,
00182                                          const XML_Char *s,
00183                                          int len);
00184 
00185 /* target and data are 0 terminated */
00186 typedef void (*XML_ProcessingInstructionHandler)(void *userData,
00187                                                  const XML_Char *target,
00188                                                  const XML_Char *data);
00189 
00190 /* data is 0 terminated */
00191 typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
00192 
00193 typedef void (*XML_StartCdataSectionHandler)(void *userData);
00194 typedef void (*XML_EndCdataSectionHandler)(void *userData);
00195 
00196 /* This is called for any characters in the XML document for
00197 which there is no applicable handler.  This includes both
00198 characters that are part of markup which is of a kind that is
00199 not reported (comments, markup declarations), or characters
00200 that are part of a construct which could be reported but
00201 for which no handler has been supplied. The characters are passed
00202 exactly as they were in the XML document except that
00203 they will be encoded in UTF-8.  Line boundaries are not normalized.
00204 Note that a byte order mark character is not passed to the default handler.
00205 There are no guarantees about how characters are divided between calls
00206 to the default handler: for example, a comment might be split between
00207 multiple calls. */
00208 
00209 typedef void (*XML_DefaultHandler)(void *userData,
00210                                    const XML_Char *s,
00211                                    int len);
00212 
00213 /* This is called for the start of the DOCTYPE declaration, before
00214    any DTD or internal subset is parsed. */
00215 
00216 typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
00217                                             const XML_Char *doctypeName,
00218                                             const XML_Char *sysid,
00219                                             const XML_Char *pubid,
00220                                             int has_internal_subset
00221                                             );
00222 
00223 /* This is called for the start of the DOCTYPE declaration when the
00224 closing > is encountered, but after processing any external subset. */
00225 typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
00226 
00227 /* This is called for entity declarations. The is_parameter_entity
00228    argument will be non-zero if the entity is a parameter entity, zero
00229    otherwise.
00230 
00231    For internal entities (<!ENTITY foo "bar">), value will
00232    be non-null and systemId, publicID, and notationName will be null.
00233    The value string is NOT null terminated; the length is provided in
00234    the value_length argument. Since it is legal to have zero-length
00235    values, do not use this argument to test for internal entities.
00236 
00237    For external entities, value will be null and systemId will be non-null.
00238    The publicId argument will be null unless a public identifier was
00239    provided. The notationName argument will have a non-null value only
00240    for unparsed entity declarations.
00241 */
00242 
00243 typedef void (*XML_EntityDeclHandler) (void *userData,
00244                                        const XML_Char *entityName,
00245                                        int is_parameter_entity,
00246                                        const XML_Char *value,
00247                                        int value_length,
00248                                        const XML_Char *base,
00249                                        const XML_Char *systemId,
00250                                        const XML_Char *publicId,
00251                                        const XML_Char *notationName);
00252                                        
00253 void XMLPARSEAPI
00254 XML_SetEntityDeclHandler(XML_Parser parser,
00255                          XML_EntityDeclHandler handler);
00256 
00257 /* OBSOLETE -- OBSOLETE -- OBSOLETE
00258    This handler has been superceded by the EntityDeclHandler above.
00259    It is provided here for backward compatibility.
00260 This is called for a declaration of an unparsed (NDATA)
00261 entity.  The base argument is whatever was set by XML_SetBase.
00262 The entityName, systemId and notationName arguments will never be null.
00263 The other arguments may be. */
00264 
00265 typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
00266                                               const XML_Char *entityName,
00267                                               const XML_Char *base,
00268                                               const XML_Char *systemId,
00269                                               const XML_Char *publicId,
00270                                               const XML_Char *notationName);
00271 
00272 /* This is called for a declaration of notation.
00273 The base argument is whatever was set by XML_SetBase.
00274 The notationName will never be null.  The other arguments can be. */
00275 
00276 typedef void (*XML_NotationDeclHandler)(void *userData,
00277                                         const XML_Char *notationName,
00278                                         const XML_Char *base,
00279                                         const XML_Char *systemId,
00280                                         const XML_Char *publicId);
00281 
00282 /* When namespace processing is enabled, these are called once for
00283 each namespace declaration. The call to the start and end element
00284 handlers occur between the calls to the start and end namespace
00285 declaration handlers. For an xmlns attribute, prefix will be null.
00286 For an xmlns="" attribute, uri will be null. */
00287 
00288 typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
00289                                               const XML_Char *prefix,
00290                                               const XML_Char *uri);
00291 
00292 typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
00293                                             const XML_Char *prefix);
00294 
00295 /* This is called if the document is not standalone (it has an
00296 external subset or a reference to a parameter entity, but does not
00297 have standalone="yes"). If this handler returns 0, then processing
00298 will not continue, and the parser will return a
00299 XML_ERROR_NOT_STANDALONE error. */
00300 
00301 typedef int (*XML_NotStandaloneHandler)(void *userData);
00302 
00303 /* This is called for a reference to an external parsed general entity.
00304 The referenced entity is not automatically parsed.
00305 The application can parse it immediately or later using
00306 XML_ExternalEntityParserCreate.
00307 The parser argument is the parser parsing the entity containing the reference;
00308 it can be passed as the parser argument to XML_ExternalEntityParserCreate.
00309 The systemId argument is the system identifier as specified in the entity declaration;
00310 it will not be null.
00311 The base argument is the system identifier that should be used as the base for
00312 resolving systemId if systemId was relative; this is set by XML_SetBase;
00313 it may be null.
00314 The publicId argument is the public identifier as specified in the entity declaration,
00315 or null if none was specified; the whitespace in the public identifier
00316 will have been normalized as required by the XML spec.
00317 The context argument specifies the parsing context in the format
00318 expected by the context argument to
00319 XML_ExternalEntityParserCreate; context is valid only until the handler
00320 returns, so if the referenced entity is to be parsed later, it must be copied.
00321 The handler should return 0 if processing should not continue because of
00322 a fatal error in the handling of the external entity.
00323 In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
00324 error.
00325 Note that unlike other handlers the first argument is the parser, not userData. */
00326 
00327 typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
00328                                             const XML_Char *context,
00329                                             const XML_Char *base,
00330                                             const XML_Char *systemId,
00331                                             const XML_Char *publicId);
00332 
00333 /* This structure is filled in by the XML_UnknownEncodingHandler
00334 to provide information to the parser about encodings that are unknown
00335 to the parser.
00336 The map[b] member gives information about byte sequences
00337 whose first byte is b.
00338 If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
00339 If map[b] is -1, then the byte sequence is malformed.
00340 If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
00341 sequence that encodes a single Unicode scalar value.
00342 The data member will be passed as the first argument to the convert function.
00343 The convert function is used to convert multibyte sequences;
00344 s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
00345 The convert function must return the Unicode scalar value
00346 represented by this byte sequence or -1 if the byte sequence is malformed.
00347 The convert function may be null if the encoding is a single-byte encoding,
00348 that is if map[b] >= -1 for all bytes b.
00349 When the parser is finished with the encoding, then if release is not null,
00350 it will call release passing it the data member;
00351 once release has been called, the convert function will not be called again.
00352 
00353 Expat places certain restrictions on the encodings that are supported
00354 using this mechanism.
00355 
00356 1. Every ASCII character that can appear in a well-formed XML document,
00357 other than the characters
00358 
00359   $@\^`{}~
00360 
00361 must be represented by a single byte, and that byte must be the
00362 same byte that represents that character in ASCII.
00363 
00364 2. No character may require more than 4 bytes to encode.
00365 
00366 3. All characters encoded must have Unicode scalar values <= 0xFFFF,
00367 (ie characters that would be encoded by surrogates in UTF-16
00368 are  not allowed).  Note that this restriction doesn't apply to
00369 the built-in support for UTF-8 and UTF-16.
00370 
00371 4. No Unicode character may be encoded by more than one distinct sequence
00372 of bytes. */
00373 
00374 typedef struct {
00375   int map[256];
00376   void *data;
00377   int (*convert)(void *data, const char *s);
00378   void (*release)(void *data);
00379 } XML_Encoding;
00380 
00381 /* This is called for an encoding that is unknown to the parser.
00382 The encodingHandlerData argument is that which was passed as the
00383 second argument to XML_SetUnknownEncodingHandler.
00384 The name argument gives the name of the encoding as specified in
00385 the encoding declaration.
00386 If the callback can provide information about the encoding,
00387 it must fill in the XML_Encoding structure, and return 1.
00388 Otherwise it must return 0.
00389 If info does not describe a suitable encoding,
00390 then the parser will return an XML_UNKNOWN_ENCODING error. */
00391 
00392 typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
00393                                           const XML_Char *name,
00394                                           XML_Encoding *info);
00395 
00396 void XMLPARSEAPI
00397 XML_SetElementHandler(XML_Parser parser,
00398                       XML_StartElementHandler start,
00399                       XML_EndElementHandler end);
00400 
00401 void XMLPARSEAPI
00402 XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
00403 
00404 void XMLPARSEAPI
00405 XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
00406 
00407 void XMLPARSEAPI
00408 XML_SetCharacterDataHandler(XML_Parser parser,
00409                             XML_CharacterDataHandler handler);
00410 
00411 void XMLPARSEAPI
00412 XML_SetProcessingInstructionHandler(XML_Parser parser,
00413                                     XML_ProcessingInstructionHandler handler);
00414 void XMLPARSEAPI
00415 XML_SetCommentHandler(XML_Parser parser,
00416                       XML_CommentHandler handler);
00417 
00418 void XMLPARSEAPI
00419 XML_SetCdataSectionHandler(XML_Parser parser,
00420                            XML_StartCdataSectionHandler start,
00421                            XML_EndCdataSectionHandler end);
00422 
00423 void XMLPARSEAPI
00424 XML_SetStartCdataSectionHandler(XML_Parser parser,
00425                                 XML_StartCdataSectionHandler start);
00426 
00427 void XMLPARSEAPI
00428 XML_SetEndCdataSectionHandler(XML_Parser parser,
00429                               XML_EndCdataSectionHandler end);
00430 
00431 /* This sets the default handler and also inhibits expansion of internal entities.
00432 The entity reference will be passed to the default handler. */
00433 
00434 void XMLPARSEAPI
00435 XML_SetDefaultHandler(XML_Parser parser,
00436                       XML_DefaultHandler handler);
00437 
00438 /* This sets the default handler but does not inhibit expansion of internal entities.
00439 The entity reference will not be passed to the default handler. */
00440 
00441 void XMLPARSEAPI
00442 XML_SetDefaultHandlerExpand(XML_Parser parser,
00443                             XML_DefaultHandler handler);
00444 
00445 void XMLPARSEAPI
00446 XML_SetDoctypeDeclHandler(XML_Parser parser,
00447                           XML_StartDoctypeDeclHandler start,
00448                           XML_EndDoctypeDeclHandler end);
00449 
00450 void XMLPARSEAPI
00451 XML_SetStartDoctypeDeclHandler(XML_Parser parser,
00452                                XML_StartDoctypeDeclHandler start);
00453 
00454 void XMLPARSEAPI
00455 XML_SetEndDoctypeDeclHandler(XML_Parser parser,
00456                              XML_EndDoctypeDeclHandler end);
00457 
00458 void XMLPARSEAPI
00459 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
00460                                  XML_UnparsedEntityDeclHandler handler);
00461 
00462 void XMLPARSEAPI
00463 XML_SetNotationDeclHandler(XML_Parser parser,
00464                            XML_NotationDeclHandler handler);
00465 
00466 void XMLPARSEAPI
00467 XML_SetNamespaceDeclHandler(XML_Parser parser,
00468                             XML_StartNamespaceDeclHandler start,
00469                             XML_EndNamespaceDeclHandler end);
00470 
00471 void XMLPARSEAPI
00472 XML_SetStartNamespaceDeclHandler(XML_Parser parser,
00473                                  XML_StartNamespaceDeclHandler start);
00474 
00475 void XMLPARSEAPI
00476 XML_SetEndNamespaceDeclHandler(XML_Parser parser,
00477                                XML_EndNamespaceDeclHandler end);
00478 
00479 void XMLPARSEAPI
00480 XML_SetNotStandaloneHandler(XML_Parser parser,
00481                             XML_NotStandaloneHandler handler);
00482 
00483 void XMLPARSEAPI
00484 XML_SetExternalEntityRefHandler(XML_Parser parser,
00485                                 XML_ExternalEntityRefHandler handler);
00486 
00487 /* If a non-null value for arg is specified here, then it will be passed
00488 as the first argument to the external entity ref handler instead
00489 of the parser object. */
00490 void XMLPARSEAPI
00491 XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
00492 
00493 void XMLPARSEAPI
00494 XML_SetUnknownEncodingHandler(XML_Parser parser,
00495                               XML_UnknownEncodingHandler handler,
00496                               void *encodingHandlerData);
00497 
00498 /* This can be called within a handler for a start element, end element,
00499 processing instruction or character data.  It causes the corresponding
00500 markup to be passed to the default handler. */
00501 void  XML_DefaultCurrent(XML_Parser parser);
00502 
00503 /* If do_nst is non-zero, and namespace processing is in effect, and
00504    a name has a prefix (i.e. an explicit namespace qualifier) then
00505    that name is returned as a triplet in a single
00506    string separated by the separator character specified when the parser
00507    was created: URI + sep + local_name + sep + prefix.
00508 
00509    If do_nst is zero, then namespace information is returned in the
00510    default manner (URI + sep + local_name) whether or not the names
00511    has a prefix.
00512 */
00513 
00514 void XMLPARSEAPI
00515 XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
00516 
00517 /* This value is passed as the userData argument to callbacks. */
00518 void XMLPARSEAPI
00519 XML_SetUserData(XML_Parser parser, void *userData);
00520 
00521 /* Returns the last value set by XML_SetUserData or null. */
00522 #define XML_GetUserData(parser) (*(void **)(parser))
00523 
00524 /* This is equivalent to supplying an encoding argument
00525 to XML_ParserCreate. It must not be called after XML_Parse
00526 or XML_ParseBuffer. */
00527 
00528 int XMLPARSEAPI
00529 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
00530 
00531 /* If this function is called, then the parser will be passed
00532 as the first argument to callbacks instead of userData.
00533 The userData will still be accessible using XML_GetUserData. */
00534 
00535 void XMLPARSEAPI 
00536 XML_UseParserAsHandlerArg(XML_Parser parser);
00537 
00538 /* Sets the base to be used for resolving relative URIs in system identifiers in
00539 declarations.  Resolving relative identifiers is left to the application:
00540 this value will be passed through as the base argument to the
00541 XML_ExternalEntityRefHandler, XML_NotationDeclHandler
00542 and XML_UnparsedEntityDeclHandler. The base argument will be copied.
00543 Returns zero if out of memory, non-zero otherwise. */
00544 
00545 int XMLPARSEAPI
00546 XML_SetBase(XML_Parser parser, const XML_Char *base);
00547 
00548 const XML_Char  XMLPARSEAPI *
00549 XML_GetBase(XML_Parser parser);
00550 
00551 /* Returns the number of the attribute/value pairs passed in last call
00552 to the XML_StartElementHandler that were specified in the start-tag
00553 rather than defaulted. Each attribute/value pair counts as 2; thus
00554 this correspondds to an index into the atts array passed to the
00555 XML_StartElementHandler. */
00556 
00557 int XMLPARSEAPI
00558 XML_GetSpecifiedAttributeCount(XML_Parser parser);
00559 
00560 /* Returns the index of the ID attribute passed in the last call to
00561 XML_StartElementHandler, or -1 if there is no ID attribute.  Each
00562 attribute/value pair counts as 2; thus this correspondds to an index
00563 into the atts array passed to the XML_StartElementHandler. */
00564 
00565 int XMLPARSEAPI
00566 XML_GetIdAttributeIndex(XML_Parser parser);
00567 
00568 /* Parses some input. Returns 0 if a fatal error is detected.
00569 The last call to XML_Parse must have isFinal true;
00570 len may be zero for this call (or any other). */
00571 int XMLPARSEAPI
00572 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
00573 
00574 void XMLPARSEAPI *
00575 XML_GetBuffer(XML_Parser parser, int len);
00576 
00577 int XMLPARSEAPI
00578 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
00579 
00580 /* Creates an XML_Parser object that can parse an external general entity;
00581 context is a '\0'-terminated string specifying the parse context;
00582 encoding is a '\0'-terminated string giving the name of the externally specified encoding,
00583 or null if there is no externally specified encoding.
00584 The context string consists of a sequence of tokens separated by formfeeds (\f);
00585 a token consisting of a name specifies that the general entity of the name
00586 is open; a token of the form prefix=uri specifies the namespace for a particular
00587 prefix; a token of the form =uri specifies the default namespace.
00588 This can be called at any point after the first call to an ExternalEntityRefHandler
00589 so longer as the parser has not yet been freed.
00590 The new parser is completely independent and may safely be used in a separate thread.
00591 The handlers and userData are initialized from the parser argument.
00592 Returns 0 if out of memory.  Otherwise returns a new XML_Parser object. */
00593 XML_Parser XMLPARSEAPI
00594 XML_ExternalEntityParserCreate(XML_Parser parser,
00595                                const XML_Char *context,
00596                                const XML_Char *encoding);
00597 
00598 enum XML_ParamEntityParsing {
00599   XML_PARAM_ENTITY_PARSING_NEVER,
00600   XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
00601   XML_PARAM_ENTITY_PARSING_ALWAYS
00602 };
00603 
00604 /* Controls parsing of parameter entities (including the external DTD
00605 subset). If parsing of parameter entities is enabled, then references
00606 to external parameter entities (including the external DTD subset)
00607 will be passed to the handler set with
00608 XML_SetExternalEntityRefHandler.  The context passed will be 0.
00609 Unlike external general entities, external parameter entities can only
00610 be parsed synchronously.  If the external parameter entity is to be
00611 parsed, it must be parsed during the call to the external entity ref
00612 handler: the complete sequence of XML_ExternalEntityParserCreate,
00613 XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
00614 this call.  After XML_ExternalEntityParserCreate has been called to
00615 create the parser for the external parameter entity (context must be 0
00616 for this call), it is illegal to make any calls on the old parser
00617 until XML_ParserFree has been called on the newly created parser.  If
00618 the library has been compiled without support for parameter entity
00619 parsing (ie without XML_DTD being defined), then
00620 XML_SetParamEntityParsing will return 0 if parsing of parameter
00621 entities is requested; otherwise it will return non-zero. */
00622 
00623 int XMLPARSEAPI
00624 XML_SetParamEntityParsing(XML_Parser parser,
00625                           enum XML_ParamEntityParsing parsing);
00626 
00627 enum XML_Error {
00628   XML_ERROR_NONE,
00629   XML_ERROR_NO_MEMORY,
00630   XML_ERROR_SYNTAX,
00631   XML_ERROR_NO_ELEMENTS,
00632   XML_ERROR_INVALID_TOKEN,
00633   XML_ERROR_UNCLOSED_TOKEN,
00634   XML_ERROR_PARTIAL_CHAR,
00635   XML_ERROR_TAG_MISMATCH,
00636   XML_ERROR_DUPLICATE_ATTRIBUTE,
00637   XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
00638   XML_ERROR_PARAM_ENTITY_REF,
00639   XML_ERROR_UNDEFINED_ENTITY,
00640   XML_ERROR_RECURSIVE_ENTITY_REF,
00641   XML_ERROR_ASYNC_ENTITY,
00642   XML_ERROR_BAD_CHAR_REF,
00643   XML_ERROR_BINARY_ENTITY_REF,
00644   XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
00645   XML_ERROR_MISPLACED_XML_PI,
00646   XML_ERROR_UNKNOWN_ENCODING,
00647   XML_ERROR_INCORRECT_ENCODING,
00648   XML_ERROR_UNCLOSED_CDATA_SECTION,
00649   XML_ERROR_EXTERNAL_ENTITY_HANDLING,
00650   XML_ERROR_NOT_STANDALONE,
00651   XML_ERROR_UNEXPECTED_STATE
00652 };
00653 
00654 /* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
00655 returns information about the error. */
00656 
00657 enum XML_Error  XMLPARSEAPI
00658 XML_GetErrorCode(XML_Parser parser);
00659 
00660 /* These functions return information about the current parse location.
00661 They may be called when XML_Parse or XML_ParseBuffer return 0;
00662 in this case the location is the location of the character at which
00663 the error was detected.
00664 They may also be called from any other callback called to report
00665 some parse event; in this the location is the location of the first
00666 of the sequence of characters that generated the event. */
00667 
00668 int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
00669 int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
00670 long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
00671 
00672 /* Return the number of bytes in the current event.
00673 Returns 0 if the event is in an internal entity. */
00674 
00675 int XMLPARSEAPI
00676 XML_GetCurrentByteCount(XML_Parser parser);
00677 
00678 /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
00679    the integer pointed to by offset to the offset within this buffer
00680    of the current parse position, and sets the integer pointed to by size
00681    to the size of this buffer (the number of input bytes). Otherwise
00682    returns a null pointer. Also returns a null pointer if a parse isn't active.
00683 
00684    NOTE: The character pointer returned should not be used outside
00685    the handler that makes the call. */
00686 
00687 const char XMLPARSEAPI *
00688 XML_GetInputContext(XML_Parser parser,
00689                     int *offset,
00690                     int *size);
00691 
00692 /* For backwards compatibility with previous versions. */
00693 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
00694 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
00695 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
00696 
00697 /* Frees memory used by the parser. */
00698 void XMLPARSEAPI
00699 XML_ParserFree(XML_Parser parser);
00700 
00701 /* Returns a string describing the error. */
00702 const XML_LChar XMLPARSEAPI *
00703 XML_ErrorString(int code);
00704 
00705 /* Return a string containing the version number of this expat */
00706 const XML_LChar XMLPARSEAPI *
00707 XML_ExpatVersion();
00708 
00709 #ifdef __cplusplus
00710 }
00711 #endif
00712 
00713 #endif /* not XmlParse_INCLUDED */


Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo
Source Perspective by Fisheye