Back to index

php5  5.3.10
php_xml.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: Stig Sæther Bakken <ssb@php.net>                            |
00016    |          Thies C. Arntzen <thies@thieso.net>                         |
00017    |          Sterling Hughes <sterling@php.net>                          |
00018    +----------------------------------------------------------------------+
00019 */
00020 
00021 /* $Id: php_xml.h 321634 2012-01-01 13:15:04Z felipe $ */
00022 
00023 #ifndef PHP_XML_H
00024 #define PHP_XML_H
00025 
00026 #ifdef HAVE_XML
00027 extern zend_module_entry xml_module_entry;
00028 #define xml_module_ptr &xml_module_entry
00029 #else
00030 #define xml_module_ptr NULL
00031 #endif
00032 
00033 #ifdef HAVE_XML 
00034 
00035 #include "ext/xml/expat_compat.h"
00036 
00037 
00038 #ifdef XML_UNICODE
00039 #error "UTF-16 Unicode support not implemented!"
00040 #endif
00041 
00042 ZEND_BEGIN_MODULE_GLOBALS(xml)
00043        XML_Char *default_encoding;
00044 ZEND_END_MODULE_GLOBALS(xml)
00045 
00046 typedef struct {
00047        int index;
00048        int case_folding;
00049        XML_Parser parser;
00050        XML_Char *target_encoding;
00051 
00052        zval *startElementHandler;
00053        zval *endElementHandler;
00054        zval *characterDataHandler;
00055        zval *processingInstructionHandler;
00056        zval *defaultHandler;
00057        zval *unparsedEntityDeclHandler;
00058        zval *notationDeclHandler;
00059        zval *externalEntityRefHandler;
00060        zval *unknownEncodingHandler;      
00061        zval *startNamespaceDeclHandler;
00062        zval *endNamespaceDeclHandler;
00063 
00064        zend_function *startElementPtr;
00065        zend_function *endElementPtr;
00066        zend_function *characterDataPtr;
00067        zend_function *processingInstructionPtr;
00068        zend_function *defaultPtr;
00069        zend_function *unparsedEntityDeclPtr;
00070        zend_function *notationDeclPtr;
00071        zend_function *externalEntityRefPtr;
00072        zend_function *unknownEncodingPtr;
00073        zend_function *startNamespaceDeclPtr;
00074        zend_function *endNamespaceDeclPtr;
00075 
00076        zval *object;
00077 
00078        zval *data;
00079        zval *info;
00080        int level;
00081        int toffset;
00082        int curtag;
00083        zval **ctag;
00084        char **ltags;
00085        int lastwasopen;
00086        int skipwhite;
00087        int isparsing;
00088        
00089        XML_Char *baseURI;
00090 } xml_parser;
00091 
00092 
00093 typedef struct {
00094        XML_Char *name;
00095        char (*decoding_function)(unsigned short);
00096        unsigned short (*encoding_function)(unsigned char);
00097 } xml_encoding;
00098 
00099 
00100 enum php_xml_option {
00101     PHP_XML_OPTION_CASE_FOLDING = 1,
00102     PHP_XML_OPTION_TARGET_ENCODING,
00103     PHP_XML_OPTION_SKIP_TAGSTART,
00104     PHP_XML_OPTION_SKIP_WHITE
00105 };
00106 
00107 /* for xml_parse_into_struct */
00108        
00109 #define XML_MAXLEVEL 255 /* XXX this should be dynamic */
00110        
00111 PHP_FUNCTION(xml_parser_create);
00112 PHP_FUNCTION(xml_parser_create_ns);
00113 PHP_FUNCTION(xml_set_object);
00114 PHP_FUNCTION(xml_set_element_handler);
00115 PHP_FUNCTION(xml_set_character_data_handler);
00116 PHP_FUNCTION(xml_set_processing_instruction_handler);
00117 PHP_FUNCTION(xml_set_default_handler);
00118 PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
00119 PHP_FUNCTION(xml_set_notation_decl_handler);
00120 PHP_FUNCTION(xml_set_external_entity_ref_handler);
00121 PHP_FUNCTION(xml_set_start_namespace_decl_handler);
00122 PHP_FUNCTION(xml_set_end_namespace_decl_handler);
00123 PHP_FUNCTION(xml_parse);
00124 PHP_FUNCTION(xml_get_error_code);
00125 PHP_FUNCTION(xml_error_string);
00126 PHP_FUNCTION(xml_get_current_line_number);
00127 PHP_FUNCTION(xml_get_current_column_number);
00128 PHP_FUNCTION(xml_get_current_byte_index);
00129 PHP_FUNCTION(xml_parser_free);
00130 PHP_FUNCTION(xml_parser_set_option);
00131 PHP_FUNCTION(xml_parser_get_option);
00132 PHP_FUNCTION(utf8_encode);
00133 PHP_FUNCTION(utf8_decode);
00134 PHP_FUNCTION(xml_parse_into_struct);
00135 
00136 PHPAPI char *_xml_zval_strdup(zval *val);
00137 PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
00138 PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding);
00139 
00140 #endif /* HAVE_LIBEXPAT */
00141 
00142 #define phpext_xml_ptr xml_module_ptr
00143 
00144 #ifdef ZTS
00145 #define XML(v) TSRMG(xml_globals_id, zend_xml_globals *, v)
00146 #else
00147 #define XML(v) (xml_globals.v)
00148 #endif
00149 
00150 #endif /* PHP_XML_H */
00151 
00152 /*
00153  * Local variables:
00154  * tab-width: 4
00155  * c-basic-offset: 4
00156  * End:
00157  */