root/ext/dom/php_dom.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. php_xpath_obj_from_obj

   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   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         int registerPhpFunctions;
  72         HashTable *registered_phpfunctions;
  73         HashTable *node_list;
  74         dom_object dom;
  75 } dom_xpath_object;
  76 
  77 static inline dom_xpath_object *php_xpath_obj_from_obj(zend_object *obj) {
  78         return (dom_xpath_object*)((char*)(obj)
  79                 - XtOffsetOf(dom_xpath_object, dom) - XtOffsetOf(dom_object, std));
  80 }
  81 
  82 #define Z_XPATHOBJ_P(zv)  php_xpath_obj_from_obj(Z_OBJ_P((zv)))
  83 
  84 typedef struct _dom_nnodemap_object {
  85         dom_object *baseobj;
  86         zval baseobj_zv;
  87         int nodetype;
  88         xmlHashTable *ht;
  89         xmlChar *local;
  90         xmlChar *ns;
  91 } dom_nnodemap_object;
  92 
  93 typedef struct {
  94         zend_object_iterator intern;
  95         zval curobj;
  96 } php_dom_iterator;
  97 
  98 #include "dom_fe.h"
  99 
 100 dom_object *dom_object_get_data(xmlNodePtr obj);
 101 dom_doc_propsptr dom_get_doc_props(php_libxml_ref_obj *document);
 102 zend_object *dom_objects_new(zend_class_entry *class_type);
 103 zend_object *dom_nnodemap_objects_new(zend_class_entry *class_type);
 104 #if defined(LIBXML_XPATH_ENABLED)
 105 zend_object *dom_xpath_objects_new(zend_class_entry *class_type);
 106 #endif
 107 int dom_get_strict_error(php_libxml_ref_obj *document);
 108 void php_dom_throw_error(int error_code, int strict_error);
 109 void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error);
 110 void node_list_unlink(xmlNodePtr node);
 111 int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len);
 112 xmlNsPtr dom_get_ns(xmlNodePtr node, char *uri, int *errorcode, char *prefix);
 113 void dom_set_old_ns(xmlDoc *doc, xmlNs *ns);
 114 xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName);
 115 void dom_normalize (xmlNodePtr nodep);
 116 xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *local, int *cur, int index);
 117 void php_dom_create_implementation(zval *retval);
 118 int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child);
 119 int dom_has_feature(char *feature, char *version);
 120 int dom_node_is_read_only(xmlNodePtr node);
 121 int dom_node_children_valid(xmlNodePtr node);
 122 void php_dom_create_interator(zval *return_value, int ce_type);
 123 void dom_namednode_iter(dom_object *basenode, int ntype, dom_object *intern, xmlHashTablePtr ht, xmlChar *local, xmlChar *ns);
 124 xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID);
 125 xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
 126 xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
 127 zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
 128 int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
 129 zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv);
 130 int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty);
 131 
 132 #define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
 133 INIT_CLASS_ENTRY(ce, name, funcs); \
 134 ce.create_object = dom_objects_new; \
 135 entry = zend_register_internal_class_ex(&ce, parent_ce);
 136 
 137 #define DOM_GET_OBJ(__ptr, __id, __prtype, __intern) { \
 138         __intern = Z_DOMOBJ_P(__id); \
 139         if (__intern->ptr == NULL || !(__ptr = (__prtype)((php_libxml_node_ptr *)__intern->ptr)->node)) { \
 140                 php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(__intern->std.ce->name));\
 141                 RETURN_NULL();\
 142         } \
 143 }
 144 
 145 #define DOM_NO_ARGS() \
 146         if (zend_parse_parameters_none() == FAILURE) { \
 147                 return; \
 148         }
 149 
 150 #define DOM_NOT_IMPLEMENTED() \
 151         php_error_docref(NULL, E_WARNING, "Not yet implemented"); \
 152         return;
 153 
 154 #define DOM_NODELIST 0
 155 #define DOM_NAMEDNODEMAP 1
 156 
 157 PHP_MINIT_FUNCTION(dom);
 158 PHP_MSHUTDOWN_FUNCTION(dom);
 159 PHP_MINFO_FUNCTION(dom);
 160 
 161 #endif /* PHP_DOM_H */
 162 
 163 /*
 164  * Local variables:
 165  * tab-width: 4
 166  * c-basic-offset: 4
 167  * End:
 168  * vim600: noet sw=4 ts=4 fdm=marker
 169  * vim<600: noet sw=4 ts=4
 170  */

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