root/ext/dom/php_dom.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 5                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 The PHP Group                                |
   6    +----------------------------------------------------------------------+
   7    | This source file is subject to version 3.01 of the PHP license,      |
   8    | that is bundled with this package in the file LICENSE, and is        |
   9    | available through the world-wide-web at the following url:           |
  10    | http://www.php.net/license/3_01.txt                                  |
  11    | If you did not receive a copy of the PHP license and are unable to   |
  12    | obtain it through the world-wide-web, please send a note to          |
  13    | license@php.net so we can mail you a copy immediately.               |
  14    +----------------------------------------------------------------------+
  15    | Authors: Christian Stocker <chregu@php.net>                          |
  16    |          Rob Richards <rrichards@php.net>                                                    |
  17    |          Marcus Borger <helly@php.net>                               |
  18    +----------------------------------------------------------------------+
  19 */
  20 
  21 /* $Id$ */
  22 
  23 #ifndef PHP_DOM_H
  24 #define PHP_DOM_H
  25 
  26 extern zend_module_entry dom_module_entry;
  27 #define phpext_dom_ptr &dom_module_entry
  28 
  29 #ifdef ZTS
  30 #include "TSRM.h"
  31 #endif
  32 
  33 #include <libxml/parser.h>
  34 #include <libxml/parserInternals.h>
  35 #include <libxml/tree.h>
  36 #include <libxml/uri.h>
  37 #include <libxml/xmlerror.h>
  38 #include <libxml/xinclude.h>
  39 #include <libxml/hash.h>
  40 #include <libxml/c14n.h>
  41 #if defined(LIBXML_HTML_ENABLED)
  42 #include <libxml/HTMLparser.h>
  43 #include <libxml/HTMLtree.h>
  44 #endif
  45 #if defined(LIBXML_XPATH_ENABLED)
  46 #include <libxml/xpath.h>
  47 #include <libxml/xpathInternals.h>
  48 #endif
  49 #if defined(LIBXML_XPTR_ENABLED)
  50 #include <libxml/xpointer.h>
  51 #endif
  52 #ifdef PHP_WIN32
  53 #ifndef DOM_EXPORTS
  54 #define DOM_EXPORTS
  55 #endif
  56 #endif
  57 
  58 #include "xml_common.h"
  59 #include "ext/libxml/php_libxml.h"
  60 #include "zend_exceptions.h"
  61 #include "dom_ce.h"
  62 /* DOM API_VERSION, please bump it up, if you change anything in the API
  63     therefore it's easier for the script-programmers to check, what's working how
  64    Can be checked with phpversion("dom");
  65 */
  66 #define DOM_API_VERSION "20031129"
  67 /* Define a custom type for iterating using an unused nodetype */
  68 #define DOM_NODESET XML_XINCLUDE_START
  69 
  70 typedef struct _dom_xpath_object {
  71         zend_object  std;
  72         void *ptr;
  73         php_libxml_ref_obj *document;
  74         HashTable *prop_handler;
  75         zend_object_handle handle;
  76         int registerPhpFunctions;
  77         HashTable *registered_phpfunctions;
  78         HashTable *node_list;
  79 } dom_xpath_object;
  80 
  81 typedef struct _dom_nnodemap_object {
  82         dom_object *baseobj;
  83         int nodetype;
  84         xmlHashTable *ht;
  85         xmlChar *local;
  86         xmlChar *ns;
  87         zval *baseobjptr;
  88 } dom_nnodemap_object;
  89 
  90 typedef struct {
  91         zend_object_iterator     intern;
  92         zval *curobj;
  93 } php_dom_iterator;
  94 
  95 #include "dom_fe.h"
  96 
  97 dom_object *dom_object_get_data(xmlNodePtr obj);
  98 dom_doc_propsptr dom_get_doc_props(php_libxml_ref_obj *document);
  99 zend_object_value dom_objects_new(zend_class_entry *class_type TSRMLS_DC);
 100 zend_object_value dom_nnodemap_objects_new(zend_class_entry *class_type TSRMLS_DC);
 101 #if defined(LIBXML_XPATH_ENABLED)
 102 zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC);
 103 #endif
 104 int dom_get_strict_error(php_libxml_ref_obj *document);
 105 void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC);
 106 void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC);
 107 void node_list_unlink(xmlNodePtr node TSRMLS_DC);
 108 int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len);
 109 xmlNsPtr dom_get_ns(xmlNodePtr node, char *uri, int *errorcode, char *prefix);
 110 void dom_set_old_ns(xmlDoc *doc, xmlNs *ns);
 111 xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName);
 112 void dom_normalize (xmlNodePtr nodep TSRMLS_DC);
 113 xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index);
 114 void php_dom_create_implementation(zval **retval  TSRMLS_DC);
 115 int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child);
 116 int dom_has_feature(char *feature, char *version);
 117 int dom_node_is_read_only(xmlNodePtr node);
 118 int dom_node_children_valid(xmlNodePtr node);
 119 void php_dom_create_interator(zval *return_value, int ce_type TSRMLS_DC);
 120 void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns TSRMLS_DC);
 121 xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
 122 xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
 123 xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
 124 zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
 125 int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce TSRMLS_DC);
 126 zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type TSRMLS_DC);
 127 int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty TSRMLS_DC);
 128 
 129 #define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
 130 INIT_CLASS_ENTRY(ce, name, funcs); \
 131 ce.create_object = dom_objects_new; \
 132 entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
 133 
 134 #define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
 135         __intern = (dom_object *)zend_object_store_get_object(__id TSRMLS_CC); \
 136         if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
 137                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", __intern->std.ce->name);\
 138                 RETURN_NULL();\
 139         } \
 140 }
 141 
 142 #define DOM_NO_ARGS() \
 143         if (zend_parse_parameters_none() == FAILURE) { \
 144                 return; \
 145         }
 146 
 147 #define DOM_NOT_IMPLEMENTED() \
 148         php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not yet implemented"); \
 149         return;
 150 
 151 #define convert_to_copy_master(orig, copy, lower_type, upper_type) \
 152         if (Z_TYPE_P(orig) != IS_##upper_type) { \
 153                 if (Z_REFCOUNT_P(orig) > 1) {        \
 154                         copy = *orig;                    \
 155                         zval_copy_ctor(&copy);           \
 156                         orig = &copy;                    \
 157                 }                                    \
 158                 convert_to_##lower_type(orig);       \
 159         }
 160 
 161 #define convert_to_string_copy(orig, copy)  convert_to_copy_master(orig, copy, string, STRING);
 162 #define convert_to_long_copy(orig, copy)    convert_to_copy_master(orig, copy, long, LONG);
 163 #define convert_to_boolean_copy(orig, copy) convert_to_copy_master(orig, copy, boolean, BOOL);
 164 
 165 #define DOM_NODELIST 0
 166 #define DOM_NAMEDNODEMAP 1
 167 
 168 PHP_MINIT_FUNCTION(dom);
 169 PHP_MSHUTDOWN_FUNCTION(dom);
 170 PHP_MINFO_FUNCTION(dom);
 171 
 172 #endif /* PHP_DOM_H */
 173 
 174 /*
 175  * Local variables:
 176  * tab-width: 4
 177  * c-basic-offset: 4
 178  * End:
 179  * vim600: noet sw=4 ts=4 fdm=marker
 180  * vim<600: noet sw=4 ts=4
 181  */

/* [<][>][^][v][top][bottom][index][help] */