Back to index

php5  5.3.10
php_dom.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: Christian Stocker <chregu@php.net>                          |
00016    |          Rob Richards <rrichards@php.net>                                               |
00017    |          Marcus Borger <helly@php.net>                               |
00018    +----------------------------------------------------------------------+
00019 */
00020 
00021 /* $Id: php_dom.h 321634 2012-01-01 13:15:04Z felipe $ */
00022 
00023 #ifndef PHP_DOM_H
00024 #define PHP_DOM_H
00025 
00026 extern zend_module_entry dom_module_entry;
00027 #define phpext_dom_ptr &dom_module_entry
00028 
00029 #ifdef ZTS
00030 #include "TSRM.h"
00031 #endif
00032 
00033 #include <libxml/parser.h>
00034 #include <libxml/parserInternals.h>
00035 #include <libxml/tree.h>
00036 #include <libxml/uri.h>
00037 #include <libxml/xmlerror.h>
00038 #include <libxml/xinclude.h>
00039 #include <libxml/hash.h>
00040 #include <libxml/c14n.h>
00041 #if defined(LIBXML_HTML_ENABLED)
00042 #include <libxml/HTMLparser.h>
00043 #include <libxml/HTMLtree.h>
00044 #endif
00045 #if defined(LIBXML_XPATH_ENABLED)
00046 #include <libxml/xpath.h>
00047 #include <libxml/xpathInternals.h>
00048 #endif
00049 #if defined(LIBXML_XPTR_ENABLED)
00050 #include <libxml/xpointer.h>
00051 #endif
00052 #ifdef PHP_WIN32
00053 #ifndef DOM_EXPORTS
00054 #define DOM_EXPORTS
00055 #endif
00056 #endif
00057 
00058 #include "xml_common.h"
00059 #include "ext/libxml/php_libxml.h"
00060 #include "zend_exceptions.h"
00061 #include "dom_ce.h"
00062 /* DOM API_VERSION, please bump it up, if you change anything in the API
00063     therefore it's easier for the script-programmers to check, what's working how
00064    Can be checked with phpversion("dom");
00065 */
00066 #define DOM_API_VERSION "20031129"
00067 /* Define a custom type for iterating using an unused nodetype */
00068 #define DOM_NODESET XML_XINCLUDE_START
00069 
00070 typedef struct _dom_xpath_object {
00071        zend_object  std;
00072        void *ptr;
00073        php_libxml_ref_obj *document;
00074        HashTable *prop_handler;
00075        zend_object_handle handle;
00076        int registerPhpFunctions;
00077        HashTable *registered_phpfunctions;
00078        HashTable *node_list;
00079 } dom_xpath_object;
00080 
00081 typedef struct _dom_nnodemap_object {
00082        dom_object *baseobj;
00083        int nodetype;
00084        xmlHashTable *ht;
00085        xmlChar *local;
00086        xmlChar *ns;
00087        zval *baseobjptr;
00088 } dom_nnodemap_object;
00089 
00090 typedef struct {
00091        zend_object_iterator     intern;
00092        zval *curobj;
00093 } php_dom_iterator;
00094 
00095 #include "dom_fe.h"
00096 
00097 dom_object *dom_object_get_data(xmlNodePtr obj);
00098 dom_doc_propsptr dom_get_doc_props(php_libxml_ref_obj *document);
00099 zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC);
00100 zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_DC);
00101 #if defined(LIBXML_XPATH_ENABLED)
00102 zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC);
00103 #endif
00104 int dom_get_strict_error(php_libxml_ref_obj *document);
00105 void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC);
00106 void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC);
00107 void node_list_unlink(xmlNodePtr node TSRMLS_DC);
00108 int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len);
00109 xmlNsPtr dom_get_ns(xmlNodePtr node, char *uri, int *errorcode, char *prefix);
00110 void dom_set_old_ns(xmlDoc *doc, xmlNs *ns);
00111 xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName);
00112 void dom_normalize (xmlNodePtr nodep TSRMLS_DC);
00113 xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index);
00114 void php_dom_create_implementation(zval **retval  TSRMLS_DC);
00115 int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child);
00116 int dom_has_feature(char *feature, char *version);
00117 int dom_node_is_read_only(xmlNodePtr node);
00118 int dom_node_children_valid(xmlNodePtr node);
00119 void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
00120 void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC);
00121 xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
00122 xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
00123 xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
00124 zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
00125 int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce TSRMLS_DC);
00126 
00127 #define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
00128 INIT_CLASS_ENTRY(ce, name, funcs); \
00129 ce.create_object = dom_objects_new; \
00130 entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
00131 
00132 #define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
00133        __intern = (dom_object *)zend_object_store_get_object(__id TSRMLS_CC); \
00134        if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
00135               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
00136               RETURN_NULL();\
00137        } \
00138 }
00139 
00140 #define DOM_NO_ARGS() \
00141        if (zend_parse_parameters_none() == FAILURE) { \
00142               return; \
00143        }
00144 
00145 #define DOM_NOT_IMPLEMENTED() \
00146        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not yet implemented"); \
00147        return;
00148 
00149 #define DOM_NODELIST 0
00150 #define DOM_NAMEDNODEMAP 1
00151 
00152 PHP_MINIT_FUNCTION(dom);
00153 PHP_MSHUTDOWN_FUNCTION(dom);
00154 PHP_MINFO_FUNCTION(dom);
00155 
00156 #endif /* PHP_DOM_H */
00157 
00158 /*
00159  * Local variables:
00160  * tab-width: 4
00161  * c-basic-offset: 4
00162  * End:
00163  * vim600: noet sw=4 ts=4 fdm=marker
00164  * vim<600: noet sw=4 ts=4
00165  */