⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expat.h

📁 这是一个完全开放的
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd   See the file COPYING for copying permission.*/#ifndef XmlParse_INCLUDED#define XmlParse_INCLUDED 1#ifdef __VMS/*      0        1         2         3      0        1         2         3        1234567890123456789012345678901     1234567890123456789012345678901 */#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler#define XML_SetUnparsedEntityDeclHandler    XML_SetUnparsedEntDeclHandler#define XML_SetStartNamespaceDeclHandler    XML_SetStartNamespcDeclHandler#define XML_SetExternalEntityRefHandlerArg  XML_SetExternalEntRefHandlerArg#endif#include <stdlib.h>#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)#define XML_USE_MSC_EXTENSIONS 1#endif/* Expat tries very hard to make the API boundary very specifically   defined.  There are two macros defined to control this boundary;   each of these can be defined before including this header to   achieve some different behavior, but doing so it not recommended or   tested frequently.   XMLCALL    - The calling convention to use for all calls across the                "library boundary."  This will default to cdecl, and                try really hard to tell the compiler that's what we                want.   XMLIMPORT  - Whatever magic is needed to note that a function is                to be imported from a dynamically loaded library                (.dll, .so, or .sl, depending on your platform).   The XMLCALL macro was added in Expat 1.95.7.  The only one which is   expected to be directly useful in client code is XMLCALL.   Note that on at least some Unix versions, the Expat library must be   compiled with the cdecl calling convention as the default since   system headers may assume the cdecl convention.*/#ifndef XMLCALL#if defined(XML_USE_MSC_EXTENSIONS)#define XMLCALL __cdecl#elif defined(__GNUC__)#define XMLCALL __attribute__((cdecl))#else/* For any platform which uses this definition and supports more than   one calling convention, we need to extend this definition to   declare the convention used on that platform, if it's possible to   do so.   If this is the case for your platform, please file a bug report   with information on how to identify your platform via the C   pre-processor and how to specify the same calling convention as the   platform's malloc() implementation.*/#define XMLCALL#endif#endif  /* not defined XMLCALL */#if !defined(XML_STATIC) && !defined(XMLIMPORT)#ifndef XML_BUILDING_EXPAT/* using Expat from an application */#ifdef XML_USE_MSC_EXTENSIONS#define XMLIMPORT __declspec(dllimport)#endif#endif#endif  /* not defined XML_STATIC *//* If we didn't define it above, define it away: */#ifndef XMLIMPORT#define XMLIMPORT#endif#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL#ifdef __cplusplusextern "C" {#endif#ifdef XML_UNICODE_WCHAR_T#define XML_UNICODE#endifstruct XML_ParserStruct;typedef struct XML_ParserStruct *XML_Parser;#ifdef XML_UNICODE     /* Information is UTF-16 encoded. */#ifdef XML_UNICODE_WCHAR_Ttypedef wchar_t XML_Char;typedef wchar_t XML_LChar;#elsetypedef unsigned short XML_Char;typedef char XML_LChar;#endif /* XML_UNICODE_WCHAR_T */#else                  /* Information is UTF-8 encoded. */typedef char XML_Char;typedef char XML_LChar;#endif /* XML_UNICODE *//* Should this be defined using stdbool.h when C99 is available? */typedef unsigned char XML_Bool;#define XML_TRUE   ((XML_Bool) 1)#define XML_FALSE  ((XML_Bool) 0)/* The XML_Status enum gives the possible return values for several   API functions.  The preprocessor #defines are included so this   stanza can be added to code that still needs to support older   versions of Expat 1.95.x:   #ifndef XML_STATUS_OK   #define XML_STATUS_OK    1   #define XML_STATUS_ERROR 0   #endif   Otherwise, the #define hackery is quite ugly and would have been   dropped.*/enum XML_Status {  XML_STATUS_ERROR = 0,#define XML_STATUS_ERROR XML_STATUS_ERROR  XML_STATUS_OK = 1#define XML_STATUS_OK XML_STATUS_OK};enum XML_Error {  XML_ERROR_NONE,  XML_ERROR_NO_MEMORY,  XML_ERROR_SYNTAX,  XML_ERROR_NO_ELEMENTS,  XML_ERROR_INVALID_TOKEN,  XML_ERROR_UNCLOSED_TOKEN,  XML_ERROR_PARTIAL_CHAR,  XML_ERROR_TAG_MISMATCH,  XML_ERROR_DUPLICATE_ATTRIBUTE,  XML_ERROR_JUNK_AFTER_DOC_ELEMENT,  XML_ERROR_PARAM_ENTITY_REF,  XML_ERROR_UNDEFINED_ENTITY,  XML_ERROR_RECURSIVE_ENTITY_REF,  XML_ERROR_ASYNC_ENTITY,  XML_ERROR_BAD_CHAR_REF,  XML_ERROR_BINARY_ENTITY_REF,  XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,  XML_ERROR_MISPLACED_XML_PI,  XML_ERROR_UNKNOWN_ENCODING,  XML_ERROR_INCORRECT_ENCODING,  XML_ERROR_UNCLOSED_CDATA_SECTION,  XML_ERROR_EXTERNAL_ENTITY_HANDLING,  XML_ERROR_NOT_STANDALONE,  XML_ERROR_UNEXPECTED_STATE,  XML_ERROR_ENTITY_DECLARED_IN_PE,  XML_ERROR_FEATURE_REQUIRES_XML_DTD,  XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,  XML_ERROR_UNBOUND_PREFIX};enum XML_Content_Type {  XML_CTYPE_EMPTY = 1,  XML_CTYPE_ANY,  XML_CTYPE_MIXED,  XML_CTYPE_NAME,  XML_CTYPE_CHOICE,  XML_CTYPE_SEQ};enum XML_Content_Quant {  XML_CQUANT_NONE,  XML_CQUANT_OPT,  XML_CQUANT_REP,  XML_CQUANT_PLUS};/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be   XML_CQUANT_NONE, and the other fields will be zero or NULL.   If type == XML_CTYPE_MIXED, then quant will be NONE or REP and   numchildren will contain number of elements that may be mixed in   and children point to an array of XML_Content cells that will be   all of XML_CTYPE_NAME type with no quantification.   If type == XML_CTYPE_NAME, then the name points to the name, and   the numchildren field will be zero and children will be NULL. The   quant fields indicates any quantifiers placed on the name.   CHOICE and SEQ will have name NULL, the number of children in   numchildren and children will point, recursively, to an array   of XML_Content cells.   The EMPTY, ANY, and MIXED types will only occur at top level.*/typedef struct XML_cp XML_Content;struct XML_cp {  enum XML_Content_Type         type;  enum XML_Content_Quant        quant;  XML_Char *                    name;  unsigned int                  numchildren;  XML_Content *                 children;};/* This is called for an element declaration. See above for   description of the model argument. It's the caller's responsibility   to free model when finished with it.*/typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,                                                const XML_Char *name,                                                XML_Content *model);XMLPARSEAPI(void)XML_SetElementDeclHandler(XML_Parser parser,                          XML_ElementDeclHandler eldecl);/* The Attlist declaration handler is called for *each* attribute. So   a single Attlist declaration with multiple attributes declared will   generate multiple calls to this handler. The "default" parameter   may be NULL in the case of the "#IMPLIED" or "#REQUIRED"   keyword. The "isrequired" parameter will be true and the default   value will be NULL in the case of "#REQUIRED". If "isrequired" is   true and default is non-NULL, then this is a "#FIXED" default.*/typedef void (XMLCALL *XML_AttlistDeclHandler) (                                    void            *userData,                                    const XML_Char  *elname,                                    const XML_Char  *attname,                                    const XML_Char  *att_type,                                    const XML_Char  *dflt,                                    int              isrequired);XMLPARSEAPI(void)XML_SetAttlistDeclHandler(XML_Parser parser,                          XML_AttlistDeclHandler attdecl);/* The XML declaration handler is called for *both* XML declarations   and text declarations. The way to distinguish is that the version   parameter will be NULL for text declarations. The encoding   parameter may be NULL for XML declarations. The standalone   parameter will be -1, 0, or 1 indicating respectively that there   was no standalone parameter in the declaration, that it was given   as no, or that it was given as yes.*/typedef void (XMLCALL *XML_XmlDeclHandler) (void           *userData,                                            const XML_Char *version,                                            const XML_Char *encoding,                                            int             standalone);XMLPARSEAPI(void)XML_SetXmlDeclHandler(XML_Parser parser,                      XML_XmlDeclHandler xmldecl);typedef struct {  void *(XMLCALL *malloc_fcn)(size_t size);  void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);  void (XMLCALL *free_fcn)(void *ptr);} XML_Memory_Handling_Suite;/* Constructs a new parser; encoding is the encoding specified by the   external protocol or NULL if there is none specified.*/XMLPARSEAPI(XML_Parser)XML_ParserCreate(const XML_Char *encoding);/* Constructs a new parser and namespace processor.  Element type   names and attribute names that belong to a namespace will be   expanded; unprefixed attribute names are never expanded; unprefixed   element type names are expanded only if there is a default   namespace. The expanded name is the concatenation of the namespace   URI, the namespace separator character, and the local part of the   name.  If the namespace separator is '\0' then the namespace URI   and the local part will be concatenated without any separator.   When a namespace is not declared, the name and prefix will be   passed through without expansion.*/XMLPARSEAPI(XML_Parser)XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);/* Constructs a new parser using the memory management suite referred to   by memsuite. If memsuite is NULL, then use the standard library memory   suite. If namespaceSeparator is non-NULL it creates a parser with   namespace processing as described above. The character pointed at   will serve as the namespace separator.   All further memory operations used for the created parser will come from   the given suite.*/XMLPARSEAPI(XML_Parser)XML_ParserCreate_MM(const XML_Char *encoding,                    const XML_Memory_Handling_Suite *memsuite,                    const XML_Char *namespaceSeparator);/* Prepare a parser object to be re-used.  This is particularly   valuable when memory allocation overhead is disproportionatly high,   such as when a large number of small documnents need to be parsed.   All handlers are cleared from the parser, except for the   unknownEncodingHandler. The parser's external state is re-initialized   except for the values of ns and ns_triplets.   Added in Expat 1.95.3.*/XMLPARSEAPI(XML_Bool)XML_ParserReset(XML_Parser parser, const XML_Char *encoding);/* atts is array of name/value pairs, terminated by 0;   names and values are 0 terminated.*/typedef void (XMLCALL *XML_StartElementHandler) (void *userData,                                                 const XML_Char *name,                                                 const XML_Char **atts);typedef void (XMLCALL *XML_EndElementHandler) (void *userData,                                               const XML_Char *name);/* s is not 0 terminated. */typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,                                                  const XML_Char *s,                                                  int len);/* target and data are 0 terminated */typedef void (XMLCALL *XML_ProcessingInstructionHandler) (                                                void *userData,                                                const XML_Char *target,                                                const XML_Char *data);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -