Back to index

php5  5.3.10
expat_compat.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Sterling Hughes <sterling@php.net>                          |
00016    +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: expat_compat.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_EXPAT_COMPAT_H
00022 #define PHP_EXPAT_COMPAT_H
00023 
00024 #ifdef PHP_WIN32
00025 #include "config.w32.h"
00026 #else
00027 #include <php_config.h>
00028 #endif
00029 
00030 #if !defined(HAVE_LIBEXPAT) && defined(HAVE_LIBXML)
00031 #define LIBXML_EXPAT_COMPAT 1
00032 
00033 #include "php.h"
00034 #include "php_compat.h"
00035 
00036 #include <libxml/parser.h>
00037 #include <libxml/parserInternals.h>
00038 #include <libxml/tree.h>
00039 #include <libxml/hash.h>
00040 
00041 typedef xmlChar XML_Char;
00042 
00043 typedef void (*XML_StartElementHandler)(void *, const XML_Char *, const XML_Char **);
00044 typedef void (*XML_EndElementHandler)(void *, const XML_Char *);
00045 typedef void (*XML_CharacterDataHandler)(void *, const XML_Char *, int);
00046 typedef void (*XML_ProcessingInstructionHandler)(void *, const XML_Char *, const XML_Char *);
00047 typedef void (*XML_CommentHandler)(void *, const XML_Char *);
00048 typedef void (*XML_DefaultHandler)(void *, const XML_Char *, int);
00049 typedef void (*XML_UnparsedEntityDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
00050 typedef void (*XML_NotationDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
00051 typedef int  (*XML_ExternalEntityRefHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
00052 typedef void (*XML_StartNamespaceDeclHandler)(void *, const XML_Char *, const XML_Char *);
00053 typedef void (*XML_EndNamespaceDeclHandler)(void *, const XML_Char *);
00054 
00055 typedef struct _XML_Memory_Handling_Suite {
00056   void *(*malloc_fcn)(size_t size);
00057   void *(*realloc_fcn)(void *ptr, size_t size);
00058   void (*free_fcn)(void *ptr);
00059 } XML_Memory_Handling_Suite;
00060 
00061 typedef struct _XML_Parser {
00062        int use_namespace;
00063 
00064        xmlChar *_ns_seperator;
00065 
00066        void *user;
00067        xmlParserCtxtPtr parser;
00068 
00069        XML_StartElementHandler          h_start_element;
00070        XML_EndElementHandler            h_end_element;
00071        XML_CharacterDataHandler         h_cdata;
00072        XML_ProcessingInstructionHandler h_pi;
00073        XML_CommentHandler               h_comment;
00074        XML_DefaultHandler               h_default;
00075        XML_UnparsedEntityDeclHandler    h_unparsed_entity_decl;
00076        XML_NotationDeclHandler          h_notation_decl;
00077        XML_ExternalEntityRefHandler     h_external_entity_ref;
00078        XML_StartNamespaceDeclHandler    h_start_ns;
00079        XML_EndNamespaceDeclHandler      h_end_ns;
00080 } *XML_Parser;
00081 
00082 enum XML_Error {
00083        XML_ERROR_NONE,
00084        XML_ERROR_NO_MEMORY,
00085        XML_ERROR_SYNTAX,
00086        XML_ERROR_NO_ELEMENTS,
00087        XML_ERROR_INVALID_TOKEN,
00088        XML_ERROR_UNCLOSED_TOKEN,
00089        XML_ERROR_PARTIAL_CHAR,
00090        XML_ERROR_TAG_MISMATCH,
00091        XML_ERROR_DUPLICATE_ATTRIBUTE,
00092        XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
00093        XML_ERROR_PARAM_ENTITY_REF,
00094        XML_ERROR_UNDEFINED_ENTITY,
00095        XML_ERROR_RECURSIVE_ENTITY_REF,
00096        XML_ERROR_ASYNC_ENTITY,
00097        XML_ERROR_BAD_CHAR_REF,
00098        XML_ERROR_BINARY_ENTITY_REF,
00099        XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
00100        XML_ERROR_MISPLACED_XML_PI,
00101        XML_ERROR_UNKNOWN_ENCODING,
00102        XML_ERROR_INCORRECT_ENCODING,
00103        XML_ERROR_UNCLOSED_CDATA_SECTION,
00104        XML_ERROR_EXTERNAL_ENTITY_HANDLING,
00105        XML_ERROR_NOT_STANDALONE,
00106        XML_ERROR_UNEXPECTED_STATE,
00107        XML_ERROR_ENTITY_DECLARED_IN_PE,
00108        XML_ERROR_FEATURE_REQUIRES_XML_DTD,
00109        XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING
00110 };
00111 
00112 enum XML_Content_Type {
00113        XML_CTYPE_EMPTY = 1,
00114        XML_CTYPE_ANY,
00115        XML_CTYPE_MIXED,
00116        XML_CTYPE_NAME,
00117        XML_CTYPE_CHOICE,
00118        XML_CTYPE_SEQ
00119 };
00120 
00121 PHPAPI XML_Parser XML_ParserCreate(const XML_Char *);
00122 PHPAPI XML_Parser XML_ParserCreateNS(const XML_Char *, const XML_Char);
00123 PHPAPI XML_Parser XML_ParserCreate_MM(const XML_Char *, const XML_Memory_Handling_Suite *, const XML_Char *);
00124 PHPAPI void XML_SetUserData(XML_Parser, void *);
00125 PHPAPI void *XML_GetUserData(XML_Parser);
00126 PHPAPI void XML_SetElementHandler(XML_Parser, XML_StartElementHandler, XML_EndElementHandler);
00127 PHPAPI void XML_SetCharacterDataHandler(XML_Parser, XML_CharacterDataHandler);
00128 PHPAPI void XML_SetProcessingInstructionHandler(XML_Parser, XML_ProcessingInstructionHandler);
00129 PHPAPI void XML_SetDefaultHandler(XML_Parser, XML_DefaultHandler);
00130 PHPAPI void XML_SetUnparsedEntityDeclHandler(XML_Parser, XML_UnparsedEntityDeclHandler);
00131 PHPAPI void XML_SetNotationDeclHandler(XML_Parser, XML_NotationDeclHandler);
00132 PHPAPI void XML_SetExternalEntityRefHandler(XML_Parser, XML_ExternalEntityRefHandler);
00133 PHPAPI void XML_SetStartNamespaceDeclHandler(XML_Parser, XML_StartNamespaceDeclHandler);
00134 PHPAPI void XML_SetEndNamespaceDeclHandler(XML_Parser, XML_EndNamespaceDeclHandler);
00135 PHPAPI int  XML_Parse(XML_Parser, const XML_Char *, int data_len, int is_final);
00136 PHPAPI int  XML_GetErrorCode(XML_Parser);
00137 PHPAPI const XML_Char *XML_ErrorString(int);
00138 PHPAPI int  XML_GetCurrentLineNumber(XML_Parser);
00139 PHPAPI int  XML_GetCurrentColumnNumber(XML_Parser);
00140 PHPAPI int  XML_GetCurrentByteIndex(XML_Parser);
00141 PHPAPI int  XML_GetCurrentByteCount(XML_Parser);
00142 PHPAPI const XML_Char *XML_ExpatVersion(void);
00143 PHPAPI void XML_ParserFree(XML_Parser);
00144 
00145 #elif defined(HAVE_LIBEXPAT)
00146 #include <expat.h>
00147 #endif /* HAVE_LIBEXPAT */
00148 
00149 #endif /* PHP_EXPAT_COMPAT_H */
00150 
00151 /*
00152  * Local variables:
00153  * tab-width: 4
00154  * c-basic-offset: 4
00155  * End:
00156  */