23#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
27typedef struct nodeIterator {
34#if LIBXML_VERSION >= 20908
35static void itemHashScanner (
void *payload,
void *
data,
const xmlChar *
name)
37static void itemHashScanner (
void *payload,
void *
data, xmlChar *
name)
40 nodeIterator *priv =
data;
42 if (priv->cur < priv->index) {
45 if (priv->node ==
NULL) {
59xmlNodePtr
create_notation(
const xmlChar *
name,
const xmlChar *ExternalID,
const xmlChar *SystemID)
61 xmlEntityPtr
ret = xmlMalloc(
sizeof(xmlEntity));
65 ret->ExternalID = xmlStrdup(ExternalID);
66 ret->SystemID = xmlStrdup(SystemID);
67 return (xmlNodePtr)
ret;
71static xmlNode *php_dom_libxml_hash_iter_ex(xmlHashTable *
ht,
int index)
75 if ((htsize = xmlHashSize(
ht)) > 0 && index < htsize) {
80 xmlHashScan(
ht, itemHashScanner, &iter);
89 xmlNode *curnode = php_dom_libxml_hash_iter_ex(objmap->
ht, index);
92 xmlNotation *notation = (xmlNotation *) curnode;
93 curnode =
create_notation(notation->name, notation->PublicID, notation->SystemID);
140 xmlNodePtr curnode = ((php_libxml_node_ptr *)intern->
ptr)->node;
144 ZVAL_STRINGL(
key, (
const char *) curnode->name, xmlStrlen(curnode->name));
161 return (xmlNodePtr) basep->properties;
167 xmlNodePtr nodep = php_dom_first_child_of_container_node(basep);
175 xmlNodePtr curnode =
NULL;
204 if (php_dom_follow_spec_intern(intern) && php_dom_is_cache_tag_stale_from_doc_ptr(&iterator->
cache_tag, intern->
document)) {
205 php_dom_mark_cache_tag_up_to_date_from_doc_ref(&iterator->
cache_tag, intern->
document);
206 curnode = dom_fetch_first_iteration_item(objmap);
208 while (curnode !=
NULL && index++ < iterator->
index) {
209 curnode = curnode->next;
212 curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->
ptr)->node;
213 curnode = curnode->next;
224 if (php_dom_is_cache_tag_stale_from_node(&iterator->
cache_tag, basenode)) {
225 php_dom_mark_cache_tag_up_to_date_from_node(&iterator->
cache_tag, basenode);
227 curnode = php_dom_first_child_of_container_node(basenode);
229 previndex = iterator->
index - 1;
230 curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->
ptr)->node;
251 php_dom_iterator_dtor,
252 php_dom_iterator_valid,
253 php_dom_iterator_current_data,
254 php_dom_iterator_current_key,
255 php_dom_iterator_move_forward,
265 xmlNodePtr curnode=
NULL;
274 iterator =
emalloc(
sizeof(*iterator));
275 memset(iterator, 0,
sizeof(*iterator));
283 if (objmap !=
NULL) {
293 curnode = dom_fetch_first_iteration_item(objmap);
memset(ptr, 0, type->size)
zend_object_iterator * php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref)
xmlNode * php_dom_libxml_hash_iter(dom_nnodemap_object *objmap, int index)
xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
xmlNode * dom_get_elements_by_tag_name_ns_raw(xmlNodePtr basep, xmlNodePtr nodep, xmlChar *ns, xmlChar *local, xmlChar *local_lower, zend_long *cur, zend_long index)
xmlNodePtr dom_nodelist_iter_start_first_child(xmlNodePtr nodep)
zend_string * dom_node_get_node_name_attribute_or_element(const xmlNode *nodep, bool uppercase)
unsigned char key[REFLECTION_KEY_LEN]
php_libxml_ref_obj * document
const zend_object_iterator_funcs * funcs
php_libxml_cache_tag cache_tag
zend_object_iterator intern
PHP_DOM_EXPORT xmlNodePtr dom_object_get_node(dom_object *obj)
struct _dom_object dom_object
PHP_DOM_EXPORT bool php_dom_create_object(xmlNodePtr obj, zval *return_value, dom_object *domobj)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
#define ZVAL_STRINGL(z, s, l)
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos)
ZEND_API zval *ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
struct _zend_object_iterator zend_object_iterator
struct _zend_object_iterator_funcs zend_object_iterator_funcs
struct _zend_class_entry zend_class_entry
struct _zend_array HashTable
#define ZVAL_NEW_STR(z, s)
#define ZVAL_OBJ_COPY(z, o)
ZEND_RESULT_CODE zend_result
ZEND_API void zval_ptr_dtor(zval *zval_ptr)