expat_compat.h000064400000014201150044124670007402 0ustar00/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Sterling Hughes | +----------------------------------------------------------------------+ */ #ifndef PHP_EXPAT_COMPAT_H #define PHP_EXPAT_COMPAT_H #ifdef PHP_WIN32 #include "config.w32.h" #else #include #endif #ifdef PHP_WIN32 # define PHP_XML_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 # define PHP_XML_API __attribute__ ((visibility("default"))) #else # define PHP_XML_API #endif #if !defined(HAVE_LIBEXPAT) && defined(HAVE_LIBXML) #define LIBXML_EXPAT_COMPAT 1 #include "php.h" #include "php_compat.h" #include #include #include #include /* For compatibility with the misspelled version. */ #define _ns_seperator _ns_separator typedef xmlChar XML_Char; typedef void (*XML_StartElementHandler)(void *, const XML_Char *, const XML_Char **); typedef void (*XML_EndElementHandler)(void *, const XML_Char *); typedef void (*XML_CharacterDataHandler)(void *, const XML_Char *, int); typedef void (*XML_ProcessingInstructionHandler)(void *, const XML_Char *, const XML_Char *); typedef void (*XML_CommentHandler)(void *, const XML_Char *); typedef void (*XML_DefaultHandler)(void *, const XML_Char *, int); typedef void (*XML_UnparsedEntityDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *); typedef void (*XML_NotationDeclHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *); typedef int (*XML_ExternalEntityRefHandler)(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *); typedef void (*XML_StartNamespaceDeclHandler)(void *, const XML_Char *, const XML_Char *); typedef void (*XML_EndNamespaceDeclHandler)(void *, const XML_Char *); typedef struct _XML_Memory_Handling_Suite { void *(*malloc_fcn)(size_t size); void *(*realloc_fcn)(void *ptr, size_t size); void (*free_fcn)(void *ptr); } XML_Memory_Handling_Suite; typedef struct _XML_Parser { int use_namespace; xmlChar *_ns_separator; void *user; xmlParserCtxtPtr parser; XML_StartElementHandler h_start_element; XML_EndElementHandler h_end_element; XML_CharacterDataHandler h_cdata; XML_ProcessingInstructionHandler h_pi; XML_CommentHandler h_comment; XML_DefaultHandler h_default; XML_UnparsedEntityDeclHandler h_unparsed_entity_decl; XML_NotationDeclHandler h_notation_decl; XML_ExternalEntityRefHandler h_external_entity_ref; XML_StartNamespaceDeclHandler h_start_ns; XML_EndNamespaceDeclHandler h_end_ns; } *XML_Parser; 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 }; enum XML_Content_Type { XML_CTYPE_EMPTY = 1, XML_CTYPE_ANY, XML_CTYPE_MIXED, XML_CTYPE_NAME, XML_CTYPE_CHOICE, XML_CTYPE_SEQ }; PHP_XML_API XML_Parser XML_ParserCreate(const XML_Char *); PHP_XML_API XML_Parser XML_ParserCreateNS(const XML_Char *, const XML_Char); PHP_XML_API XML_Parser XML_ParserCreate_MM(const XML_Char *, const XML_Memory_Handling_Suite *, const XML_Char *); PHP_XML_API void XML_SetUserData(XML_Parser, void *); PHP_XML_API void *XML_GetUserData(XML_Parser); PHP_XML_API void XML_SetElementHandler(XML_Parser, XML_StartElementHandler, XML_EndElementHandler); PHP_XML_API void XML_SetCharacterDataHandler(XML_Parser, XML_CharacterDataHandler); PHP_XML_API void XML_SetProcessingInstructionHandler(XML_Parser, XML_ProcessingInstructionHandler); PHP_XML_API void XML_SetDefaultHandler(XML_Parser, XML_DefaultHandler); PHP_XML_API void XML_SetUnparsedEntityDeclHandler(XML_Parser, XML_UnparsedEntityDeclHandler); PHP_XML_API void XML_SetNotationDeclHandler(XML_Parser, XML_NotationDeclHandler); PHP_XML_API void XML_SetExternalEntityRefHandler(XML_Parser, XML_ExternalEntityRefHandler); PHP_XML_API void XML_SetStartNamespaceDeclHandler(XML_Parser, XML_StartNamespaceDeclHandler); PHP_XML_API void XML_SetEndNamespaceDeclHandler(XML_Parser, XML_EndNamespaceDeclHandler); PHP_XML_API int XML_Parse(XML_Parser, const XML_Char *, int data_len, int is_final); PHP_XML_API int XML_GetErrorCode(XML_Parser); PHP_XML_API const XML_Char *XML_ErrorString(int); PHP_XML_API int XML_GetCurrentLineNumber(XML_Parser); PHP_XML_API int XML_GetCurrentColumnNumber(XML_Parser); PHP_XML_API int XML_GetCurrentByteIndex(XML_Parser); PHP_XML_API int XML_GetCurrentByteCount(XML_Parser); PHP_XML_API const XML_Char *XML_ExpatVersion(void); PHP_XML_API void XML_ParserFree(XML_Parser); #elif defined(HAVE_LIBEXPAT) #include "php.h" #include #endif /* HAVE_LIBEXPAT */ #endif /* PHP_EXPAT_COMPAT_H */ php_xml.h000064400000003043150044124670006367 0ustar00/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Stig Sæther Bakken | | Thies C. Arntzen | | Sterling Hughes | +----------------------------------------------------------------------+ */ #ifndef PHP_XML_H #define PHP_XML_H #ifdef HAVE_XML extern zend_module_entry xml_module_entry; #define xml_module_ptr &xml_module_entry #include "php_version.h" #define PHP_XML_VERSION PHP_VERSION #include "expat_compat.h" #ifdef XML_UNICODE #error "UTF-16 Unicode support not implemented!" #endif #else #define xml_module_ptr NULL #endif /* HAVE_XML */ #define phpext_xml_ptr xml_module_ptr #endif /* PHP_XML_H */ xml_arginfo.h000064400000013630150044124670007230 0ustar00/* This is a generated file, edit the .stub.php file instead. * Stub hash: d42215062c41775bae538cd310bc60e63fa06a8e */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create, 0, 0, XMLParser, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, XMLParser, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\":\"") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_object, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_element_handler, 0, 3, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_INFO(0, start_handler) ZEND_ARG_INFO(0, end_handler) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_character_data_handler, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_INFO(0, handler) ZEND_END_ARG_INFO() #define arginfo_xml_set_processing_instruction_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_default_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_unparsed_entity_decl_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_notation_decl_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_external_entity_ref_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_start_namespace_decl_handler arginfo_xml_set_character_data_handler #define arginfo_xml_set_end_namespace_decl_handler arginfo_xml_set_character_data_handler ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse, 0, 2, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, is_final, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse_into_struct, 0, 3, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) ZEND_ARG_INFO(1, values) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, index, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_get_error_code, 0, 1, IS_LONG, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_error_string, 0, 1, IS_STRING, 1) ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0) ZEND_END_ARG_INFO() #define arginfo_xml_get_current_line_number arginfo_xml_get_error_code #define arginfo_xml_get_current_column_number arginfo_xml_get_error_code #define arginfo_xml_get_current_byte_index arginfo_xml_get_error_code ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_free, 0, 1, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_set_option, 0, 3, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_xml_parser_get_option, 0, 2, MAY_BE_STRING|MAY_BE_LONG) ZEND_ARG_OBJ_INFO(0, parser, XMLParser, 0) ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_FUNCTION(xml_parser_create); ZEND_FUNCTION(xml_parser_create_ns); ZEND_FUNCTION(xml_set_object); ZEND_FUNCTION(xml_set_element_handler); ZEND_FUNCTION(xml_set_character_data_handler); ZEND_FUNCTION(xml_set_processing_instruction_handler); ZEND_FUNCTION(xml_set_default_handler); ZEND_FUNCTION(xml_set_unparsed_entity_decl_handler); ZEND_FUNCTION(xml_set_notation_decl_handler); ZEND_FUNCTION(xml_set_external_entity_ref_handler); ZEND_FUNCTION(xml_set_start_namespace_decl_handler); ZEND_FUNCTION(xml_set_end_namespace_decl_handler); ZEND_FUNCTION(xml_parse); ZEND_FUNCTION(xml_parse_into_struct); ZEND_FUNCTION(xml_get_error_code); ZEND_FUNCTION(xml_error_string); ZEND_FUNCTION(xml_get_current_line_number); ZEND_FUNCTION(xml_get_current_column_number); ZEND_FUNCTION(xml_get_current_byte_index); ZEND_FUNCTION(xml_parser_free); ZEND_FUNCTION(xml_parser_set_option); ZEND_FUNCTION(xml_parser_get_option); static const zend_function_entry ext_functions[] = { ZEND_FE(xml_parser_create, arginfo_xml_parser_create) ZEND_FE(xml_parser_create_ns, arginfo_xml_parser_create_ns) ZEND_FE(xml_set_object, arginfo_xml_set_object) ZEND_FE(xml_set_element_handler, arginfo_xml_set_element_handler) ZEND_FE(xml_set_character_data_handler, arginfo_xml_set_character_data_handler) ZEND_FE(xml_set_processing_instruction_handler, arginfo_xml_set_processing_instruction_handler) ZEND_FE(xml_set_default_handler, arginfo_xml_set_default_handler) ZEND_FE(xml_set_unparsed_entity_decl_handler, arginfo_xml_set_unparsed_entity_decl_handler) ZEND_FE(xml_set_notation_decl_handler, arginfo_xml_set_notation_decl_handler) ZEND_FE(xml_set_external_entity_ref_handler, arginfo_xml_set_external_entity_ref_handler) ZEND_FE(xml_set_start_namespace_decl_handler, arginfo_xml_set_start_namespace_decl_handler) ZEND_FE(xml_set_end_namespace_decl_handler, arginfo_xml_set_end_namespace_decl_handler) ZEND_FE(xml_parse, arginfo_xml_parse) ZEND_FE(xml_parse_into_struct, arginfo_xml_parse_into_struct) ZEND_FE(xml_get_error_code, arginfo_xml_get_error_code) ZEND_FE(xml_error_string, arginfo_xml_error_string) ZEND_FE(xml_get_current_line_number, arginfo_xml_get_current_line_number) ZEND_FE(xml_get_current_column_number, arginfo_xml_get_current_column_number) ZEND_FE(xml_get_current_byte_index, arginfo_xml_get_current_byte_index) ZEND_FE(xml_parser_free, arginfo_xml_parser_free) ZEND_FE(xml_parser_set_option, arginfo_xml_parser_set_option) ZEND_FE(xml_parser_get_option, arginfo_xml_parser_get_option) ZEND_FE_END }; static const zend_function_entry class_XMLParser_methods[] = { ZEND_FE_END };