Lines Matching refs:sxe
47 static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data);
48 static xmlNodePtr php_sxe_reset_iterator_no_clear_iter_data(php_sxe_object *sxe, int use_data);
49 static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data);
59 static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE_ITER itertype, cha… in _node_as_zval() argument
63 subnode = php_sxe_object_new(sxe->zo.ce, sxe->fptr_count); in _node_as_zval()
64 subnode->document = sxe->document; in _node_as_zval()
81 static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node) in php_sxe_get_first_node() argument
83 if (sxe && sxe->iter.type != SXE_ITER_NONE) { in php_sxe_get_first_node()
84 return php_sxe_reset_iterator(sxe, 1); in php_sxe_get_first_node()
90 static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, int prefix) /* {{{ … in match_ns() argument
104 static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, zend_long offset, xmlNodePtr node,… in sxe_get_element_by_offset() argument
108 if (sxe->iter.type == SXE_ITER_NONE) { in sxe_get_element_by_offset()
120 …if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))… in sxe_get_element_by_offset()
121 if (sxe->iter.type == SXE_ITER_CHILD || ( in sxe_get_element_by_offset()
122 sxe->iter.type == SXE_ITER_ELEMENT && !xmlStrcmp(node->name, sxe->iter.name))) { in sxe_get_element_by_offset()
141 static xmlNodePtr sxe_find_element_by_name(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name) /* … in sxe_find_element_by_name() argument
145 …if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))… in sxe_find_element_by_name()
156 static xmlNodePtr sxe_get_element_by_name(php_sxe_object *sxe, xmlNodePtr node, char **name, SXE_IT… in sxe_get_element_by_name() argument
162 if (sxe->iter.type != SXE_ITER_ATTRLIST) in sxe_get_element_by_name()
164 orgtype = sxe->iter.type; in sxe_get_element_by_name()
165 if (sxe->iter.type == SXE_ITER_NONE) { in sxe_get_element_by_name()
166 sxe->iter.type = SXE_ITER_CHILD; in sxe_get_element_by_name()
168 node = php_sxe_get_first_node(sxe, node); in sxe_get_element_by_name()
169 sxe->iter.type = orgtype; in sxe_get_element_by_name()
172 if (sxe->iter.type == SXE_ITER_ELEMENT) { in sxe_get_element_by_name()
173 orgnode = sxe_find_element_by_name(sxe, node, sxe->iter.name); in sxe_get_element_by_name()
182 …if (node->type == XML_ELEMENT_NODE && match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefix))… in sxe_get_element_by_name()
210 php_sxe_object *sxe; in sxe_prop_dim_read() local
218 sxe = php_sxe_fetch_object(object); in sxe_prop_dim_read()
221 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_read()
230 if (sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_prop_dim_read()
249 GET_NODE(sxe, node); in sxe_prop_dim_read()
251 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_read()
254 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_read()
256 test = sxe->iter.name != NULL; in sxe_prop_dim_read()
257 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_prop_dim_read()
258 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_read()
273 if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_read()
276 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->ite… in sxe_prop_dim_read()
278 …_node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.ispre… in sxe_prop_dim_read()
287 …rcmp(attr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)name) && match_ns(sxe, (xml… in sxe_prop_dim_read()
288 …_node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.ispre… in sxe_prop_dim_read()
298 if (!sxe->node) { in sxe_prop_dim_read()
299 php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL); in sxe_prop_dim_read()
305 if (sxe->iter.type == SXE_ITER_CHILD) { in sxe_prop_dim_read()
306 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_read()
308 if (sxe->iter.type == SXE_ITER_NONE) { in sxe_prop_dim_read()
313 node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); in sxe_prop_dim_read()
318 _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix); in sxe_prop_dim_read()
324 _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix); in sxe_prop_dim_read()
328 if (type != BP_VAR_IS || sxe_find_element_by_name(sxe, node->children, (xmlChar *) name)) { in sxe_prop_dim_read()
329 _node_as_zval(sxe, node, rv, SXE_ITER_ELEMENT, name, sxe->iter.nsprefix, sxe->iter.isprefix); in sxe_prop_dim_read()
378 php_sxe_object *sxe; in sxe_prop_dim_write() local
393 sxe = php_sxe_fetch_object(object); in sxe_prop_dim_write()
396 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_write()
408 if (sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_prop_dim_write()
435 GET_NODE(sxe, node); in sxe_prop_dim_write()
437 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_write()
440 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_write()
442 test = sxe->iter.name != NULL; in sxe_prop_dim_write()
443 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_prop_dim_write()
445 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_write()
457 if (attribs && !node && sxe->iter.type == SXE_ITER_ELEMENT) { in sxe_prop_dim_write()
458 node = xmlNewChild(mynode, mynode->ns, sxe->iter.name, NULL); in sxe_prop_dim_write()
500 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->ite… in sxe_prop_dim_write()
512 …tr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sx… in sxe_prop_dim_write()
533 if (sxe->iter.type == SXE_ITER_NONE) { in sxe_prop_dim_write()
541 newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); in sxe_prop_dim_write()
551 …cmp(node->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, node, sxe->iter.nsprefix, sxe->ite… in sxe_prop_dim_write()
630 php_sxe_object *sxe; in sxe_property_get_adr() local
637 sxe = php_sxe_fetch_object(object); in sxe_property_get_adr()
638 GET_NODE(sxe, node); in sxe_property_get_adr()
640 node = sxe_get_element_by_name(sxe, node, &name, &type); in sxe_property_get_adr()
651 _node_as_zval(sxe, node, &ret, type, name, sxe->iter.nsprefix, sxe->iter.isprefix); in sxe_property_get_adr()
653 if (!Z_ISUNDEF(sxe->tmp)) { in sxe_property_get_adr()
654 zval_ptr_dtor(&sxe->tmp); in sxe_property_get_adr()
657 ZVAL_COPY_VALUE(&sxe->tmp, &ret); in sxe_property_get_adr()
659 return &sxe->tmp; in sxe_property_get_adr()
666 php_sxe_object *sxe; in sxe_prop_dim_exists() local
682 sxe = php_sxe_fetch_object(object); in sxe_prop_dim_exists()
684 GET_NODE(sxe, node); in sxe_prop_dim_exists()
687 if (sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_prop_dim_exists()
690 if (sxe->iter.type == SXE_ITER_CHILD) { in sxe_prop_dim_exists()
691 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_exists()
696 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_exists()
699 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_exists()
701 test = sxe->iter.name != NULL; in sxe_prop_dim_exists()
702 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_prop_dim_exists()
703 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_exists()
714 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->ite… in sxe_prop_dim_exists()
725 …tr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sx… in sxe_prop_dim_exists()
742 if (sxe->iter.type == SXE_ITER_CHILD) { in sxe_prop_dim_exists()
743 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_exists()
745 node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); in sxe_prop_dim_exists()
747 node = sxe_find_element_by_name(sxe, node->children, (xmlChar *)Z_STRVAL_P(member)); in sxe_prop_dim_exists()
787 php_sxe_object *sxe; in sxe_prop_dim_delete() local
804 sxe = php_sxe_fetch_object(object); in sxe_prop_dim_delete()
806 GET_NODE(sxe, node); in sxe_prop_dim_delete()
809 if (sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_prop_dim_delete()
812 if (sxe->iter.type == SXE_ITER_CHILD) { in sxe_prop_dim_delete()
813 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_delete()
818 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in sxe_prop_dim_delete()
821 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_delete()
823 test = sxe->iter.name != NULL; in sxe_prop_dim_delete()
824 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_prop_dim_delete()
825 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_delete()
836 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->ite… in sxe_prop_dim_delete()
849 …tr->name, sxe->iter.name)) && !xmlStrcmp(attr->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sx… in sxe_prop_dim_delete()
861 if (sxe->iter.type == SXE_ITER_CHILD) { in sxe_prop_dim_delete()
862 node = php_sxe_get_first_node(sxe, node); in sxe_prop_dim_delete()
864 node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); in sxe_prop_dim_delete()
876 …cmp(node->name, (xmlChar *)Z_STRVAL_P(member)) && match_ns(sxe, node, sxe->iter.nsprefix, sxe->ite… in sxe_prop_dim_delete()
979 php_sxe_object *sxe; in sxe_prop_is_empty() local
987 sxe = php_sxe_fetch_object(object); in sxe_prop_is_empty()
989 GET_NODE(sxe, node); in sxe_prop_is_empty()
994 if (sxe->iter.type == SXE_ITER_ELEMENT) { in sxe_prop_is_empty()
995 node = php_sxe_get_first_node(sxe, node); in sxe_prop_is_empty()
999 test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST; in sxe_prop_is_empty()
1001 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter… in sxe_prop_is_empty()
1008 GET_NODE(sxe, node); in sxe_prop_is_empty()
1009 node = php_sxe_get_first_node(sxe, node); in sxe_prop_is_empty()
1012 if (node && sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_prop_is_empty()
1015 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_prop_is_empty()
1016 …if (sxe->iter.type == SXE_ITER_NONE || !node->children || !node->parent || node->children->next ||… in sxe_prop_is_empty()
1019 ZVAL_COPY_VALUE(&iter_data, &sxe->iter.data); in sxe_prop_is_empty()
1020 ZVAL_UNDEF(&sxe->iter.data); in sxe_prop_is_empty()
1021 node = php_sxe_reset_iterator(sxe, 0); in sxe_prop_is_empty()
1040 …if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefi… in sxe_prop_is_empty()
1052 node = php_sxe_iterator_fetch(sxe, node->next, 0); in sxe_prop_is_empty()
1060 if (!Z_ISUNDEF(sxe->iter.data)) { in sxe_prop_is_empty()
1061 zval_ptr_dtor(&sxe->iter.data); in sxe_prop_is_empty()
1063 ZVAL_COPY_VALUE(&sxe->iter.data, &iter_data); in sxe_prop_is_empty()
1075 php_sxe_object *sxe; in sxe_get_prop_hash() local
1086 sxe = php_sxe_fetch_object(object); in sxe_get_prop_hash()
1090 } else if (sxe->properties) { in sxe_get_prop_hash()
1091 zend_hash_clean(sxe->properties); in sxe_get_prop_hash()
1092 rv = sxe->properties; in sxe_get_prop_hash()
1095 sxe->properties = rv; in sxe_get_prop_hash()
1098 GET_NODE(sxe, node); in sxe_get_prop_hash()
1102 if (is_debug || sxe->iter.type != SXE_ITER_CHILD) { in sxe_get_prop_hash()
1103 if (sxe->iter.type == SXE_ITER_ELEMENT) { in sxe_get_prop_hash()
1104 node = php_sxe_get_first_node(sxe, node); in sxe_get_prop_hash()
1109 test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST; in sxe_get_prop_hash()
1111 …if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr)attr, sxe->iter… in sxe_get_prop_hash()
1112 ZVAL_STR(&value, sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1)); in sxe_get_prop_hash()
1125 GET_NODE(sxe, node); in sxe_get_prop_hash()
1126 node = php_sxe_get_first_node(sxe, node); in sxe_get_prop_hash()
1128 if (node && sxe->iter.type != SXE_ITER_ATTRLIST) { in sxe_get_prop_hash()
1133 } else if (sxe->iter.type != SXE_ITER_CHILD) { in sxe_get_prop_hash()
1135 …if ( sxe->iter.type == SXE_ITER_NONE || !node->children || !node->parent || !node->next || node->c… in sxe_get_prop_hash()
1138 ZVAL_COPY_VALUE(&iter_data, &sxe->iter.data); in sxe_get_prop_hash()
1139 ZVAL_UNDEF(&sxe->iter.data); in sxe_get_prop_hash()
1141 node = php_sxe_reset_iterator(sxe, 0); in sxe_get_prop_hash()
1162 …if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix, sxe->iter.isprefi… in sxe_get_prop_hash()
1173 _get_base_node_value(sxe, node, &value, sxe->iter.nsprefix, sxe->iter.isprefix); in sxe_get_prop_hash()
1188 node = php_sxe_iterator_fetch(sxe, node->next, 0); in sxe_get_prop_hash()
1196 if (!Z_ISUNDEF(sxe->iter.data)) { in sxe_get_prop_hash()
1197 zval_ptr_dtor(&sxe->iter.data); in sxe_get_prop_hash()
1199 ZVAL_COPY_VALUE(&sxe->iter.data, &iter_data); in sxe_get_prop_hash()
1207 php_sxe_object *sxe; in sxe_get_gc() local
1208 sxe = php_sxe_fetch_object(object); in sxe_get_gc()
1212 return sxe->properties; in sxe_get_gc()
1263 php_sxe_object *sxe; in PHP_METHOD() local
1278 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1280 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
1284 GET_NODE(sxe, nodeptr); in PHP_METHOD()
1285 nodeptr = php_sxe_get_first_node(sxe, nodeptr); in PHP_METHOD()
1290 if (!sxe->xpath) { in PHP_METHOD()
1291 sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr); in PHP_METHOD()
1293 sxe->xpath->node = nodeptr; in PHP_METHOD()
1295 ns = xmlGetNsList((xmlDocPtr) sxe->document->ptr, nodeptr); in PHP_METHOD()
1302 sxe->xpath->namespaces = ns; in PHP_METHOD()
1303 sxe->xpath->nsNr = nsnbr; in PHP_METHOD()
1305 retval = xmlXPathEval((xmlChar *)query, sxe->xpath); in PHP_METHOD()
1308 sxe->xpath->namespaces = NULL; in PHP_METHOD()
1309 sxe->xpath->nsNr = 0; in PHP_METHOD()
1330 _node_as_zval(sxe, nodeptr->parent, &value, SXE_ITER_NONE, NULL, NULL, 0); in PHP_METHOD()
1332 …_node_as_zval(sxe, nodeptr->parent, &value, SXE_ITER_ATTRLIST, (char*)nodeptr->name, nodeptr->ns ?… in PHP_METHOD()
1334 _node_as_zval(sxe, nodeptr, &value, SXE_ITER_NONE, NULL, NULL, 0); in PHP_METHOD()
1351 php_sxe_object *sxe; in PHP_METHOD() local
1359 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1360 if (!sxe->document) { in PHP_METHOD()
1365 if (!sxe->xpath) { in PHP_METHOD()
1366 sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr); in PHP_METHOD()
1369 if (xmlXPathRegisterNs(sxe->xpath, (xmlChar *)prefix, (xmlChar *)ns_uri) != 0) { in PHP_METHOD()
1380 php_sxe_object *sxe; in PHP_METHOD() local
1392 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1393 GET_NODE(sxe, node); in PHP_METHOD()
1394 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1403 bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr); in PHP_METHOD()
1416 xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL); in PHP_METHOD()
1423 …xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocP… in PHP_METHOD()
1440 …xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) … in PHP_METHOD()
1475 static void sxe_add_namespaces(php_sxe_object *sxe, xmlNodePtr node, bool recursive, zval *return_v… in sxe_add_namespaces() argument
1495 sxe_add_namespaces(sxe, node, recursive, return_value); in sxe_add_namespaces()
1506 php_sxe_object *sxe; in PHP_METHOD() local
1515 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1516 GET_NODE(sxe, node); in PHP_METHOD()
1517 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1521 sxe_add_namespaces(sxe, node, recursive, return_value); in PHP_METHOD()
1529 static void sxe_add_registered_namespaces(php_sxe_object *sxe, xmlNodePtr node, bool recursive, zva… in sxe_add_registered_namespaces() argument
1542 sxe_add_registered_namespaces(sxe, node, recursive, return_value); in sxe_add_registered_namespaces()
1554 php_sxe_object *sxe; in PHP_METHOD() local
1561 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1563 if (!sxe->document) { in PHP_METHOD()
1568 node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr); in PHP_METHOD()
1570 GET_NODE(sxe, node); in PHP_METHOD()
1578 sxe_add_registered_namespaces(sxe, node, recursive, return_value); in PHP_METHOD()
1585 php_sxe_object *sxe; in PHP_METHOD() local
1595 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1597 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
1601 GET_NODE(sxe, node); in PHP_METHOD()
1602 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1607 _node_as_zval(sxe, node, return_value, SXE_ITER_CHILD, NULL, (xmlChar *)nsprefix, isprefix); in PHP_METHOD()
1615 php_sxe_object *sxe; in PHP_METHOD() local
1623 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1625 GET_NODE(sxe, node); in PHP_METHOD()
1626 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1639 php_sxe_object *sxe; in PHP_METHOD() local
1649 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1650 GET_NODE(sxe, node); in PHP_METHOD()
1651 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1656 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
1660 _node_as_zval(sxe, node, return_value, SXE_ITER_ATTRLIST, NULL, (xmlChar *)nsprefix, isprefix); in PHP_METHOD()
1667 php_sxe_object *sxe; in PHP_METHOD() local
1684 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1685 GET_NODE(sxe, node); in PHP_METHOD()
1687 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
1692 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1719 _node_as_zval(sxe, newnode, return_value, SXE_ITER_NONE, (char *)localname, prefix, 0); in PHP_METHOD()
1731 php_sxe_object *sxe; in PHP_METHOD() local
1749 sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD()
1750 GET_NODE(sxe, node); in PHP_METHOD()
1752 node = php_sxe_get_first_node(sxe, node); in PHP_METHOD()
1836 php_sxe_object *sxe; in sxe_object_cast_ex() local
1842 sxe = php_sxe_fetch_object(readobj); in sxe_object_cast_ex()
1845 node = php_sxe_get_first_node(sxe, NULL); in sxe_object_cast_ex()
1854 if (sxe->iter.type != SXE_ITER_NONE) { in sxe_object_cast_ex()
1855 node = php_sxe_get_first_node(sxe, NULL); in sxe_object_cast_ex()
1857 contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, node->children, 1); in sxe_object_cast_ex()
1860 if (!sxe->node) { in sxe_object_cast_ex()
1861 if (sxe->document) { in sxe_object_cast_ex()
1862 …php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe-… in sxe_object_cast_ex()
1866 if (sxe->node && sxe->node->node) { in sxe_object_cast_ex()
1867 if (sxe->node->node->children) { in sxe_object_cast_ex()
1868 contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, sxe->node->node->children, 1); in sxe_object_cast_ex()
1869 } else if (sxe->node->node->type == XML_COMMENT_NODE || sxe->node->node->type == XML_PI_NODE) { in sxe_object_cast_ex()
1870 contents = sxe->node->node->content; in sxe_object_cast_ex()
1913 static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count) /* {{{ */ in php_sxe_count_elements_helper() argument
1920 ZVAL_COPY_VALUE(&data, &sxe->iter.data); in php_sxe_count_elements_helper()
1921 ZVAL_UNDEF(&sxe->iter.data); in php_sxe_count_elements_helper()
1923 node = php_sxe_reset_iterator(sxe, 0); in php_sxe_count_elements_helper()
1928 node = php_sxe_iterator_fetch(sxe, node->next, 0); in php_sxe_count_elements_helper()
1931 if (!Z_ISUNDEF(sxe->iter.data)) { in php_sxe_count_elements_helper()
1932 zval_ptr_dtor(&sxe->iter.data); in php_sxe_count_elements_helper()
1934 ZVAL_COPY_VALUE(&sxe->iter.data, &data); in php_sxe_count_elements_helper()
1962 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
1968 php_sxe_count_elements_helper(sxe, &count); in PHP_METHOD()
1989 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
1995 RETURN_BOOL(!Z_ISUNDEF(sxe->iter.data)); in PHP_METHOD()
2002 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
2008 if (Z_ISUNDEF(sxe->iter.data)) { in PHP_METHOD()
2013 RETURN_COPY_DEREF(&sxe->iter.data); in PHP_METHOD()
2022 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
2028 if (Z_ISUNDEF(sxe->iter.data)) { in PHP_METHOD()
2033 intern = Z_SXEOBJ_P(&sxe->iter.data); in PHP_METHOD()
2058 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
2066 if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
2069 child = Z_SXEOBJ_P(&sxe->iter.data); in PHP_METHOD()
2085 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
2091 if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) { in PHP_METHOD()
2095 RETURN_COPY_DEREF(&sxe->iter.data); in PHP_METHOD()
2104 php_sxe_object *sxe = php_sxe_fetch_object(object); in sxe_object_clone() local
2108 bool is_root_element = sxe->node && sxe->node->node && sxe->node->node->parent in sxe_object_clone()
2109 …&& (sxe->node->node->parent->type == XML_DOCUMENT_NODE || sxe->node->node->parent->type == XML_HTM… in sxe_object_clone()
2111 clone = php_sxe_object_new(sxe->zo.ce, sxe->fptr_count); in sxe_object_clone()
2114 docp = xmlCopyDoc(sxe->document->ptr, 1); in sxe_object_clone()
2117 clone->document = sxe->document; in sxe_object_clone()
2124 clone->iter.isprefix = sxe->iter.isprefix; in sxe_object_clone()
2125 if (sxe->iter.name != NULL) { in sxe_object_clone()
2126 clone->iter.name = (xmlChar*)estrdup((char*)sxe->iter.name); in sxe_object_clone()
2128 if (sxe->iter.nsprefix != NULL) { in sxe_object_clone()
2129 clone->iter.nsprefix = (xmlChar*)estrdup((char*)sxe->iter.nsprefix); in sxe_object_clone()
2131 clone->iter.type = sxe->iter.type; in sxe_object_clone()
2133 if (sxe->node) { in sxe_object_clone()
2137 nodep = xmlDocCopyNode(sxe->node->node, docp, 1); in sxe_object_clone()
2150 php_sxe_object *sxe; in sxe_object_free_storage() local
2152 sxe = php_sxe_fetch_object(object); in sxe_object_free_storage()
2154 zend_object_std_dtor(&sxe->zo); in sxe_object_free_storage()
2156 if (!Z_ISUNDEF(sxe->iter.data)) { in sxe_object_free_storage()
2157 zval_ptr_dtor(&sxe->iter.data); in sxe_object_free_storage()
2158 ZVAL_UNDEF(&sxe->iter.data); in sxe_object_free_storage()
2161 if (sxe->iter.name) { in sxe_object_free_storage()
2162 efree(sxe->iter.name); in sxe_object_free_storage()
2163 sxe->iter.name = NULL; in sxe_object_free_storage()
2165 if (sxe->iter.nsprefix) { in sxe_object_free_storage()
2166 efree(sxe->iter.nsprefix); in sxe_object_free_storage()
2167 sxe->iter.nsprefix = NULL; in sxe_object_free_storage()
2169 if (!Z_ISUNDEF(sxe->tmp)) { in sxe_object_free_storage()
2170 zval_ptr_dtor(&sxe->tmp); in sxe_object_free_storage()
2171 ZVAL_UNDEF(&sxe->tmp); in sxe_object_free_storage()
2174 php_libxml_node_decrement_resource((php_libxml_node_object *)sxe); in sxe_object_free_storage()
2176 if (sxe->xpath) { in sxe_object_free_storage()
2177 xmlXPathFreeContext(sxe->xpath); in sxe_object_free_storage()
2180 if (sxe->properties) { in sxe_object_free_storage()
2181 zend_hash_destroy(sxe->properties); in sxe_object_free_storage()
2182 FREE_HASHTABLE(sxe->properties); in sxe_object_free_storage()
2247 php_sxe_object *sxe; in PHP_FUNCTION() local
2281 sxe = php_sxe_object_new(ce, fptr_count); in PHP_FUNCTION()
2282 sxe->iter.nsprefix = ns_len ? (xmlChar*)estrdup(ns) : NULL; in PHP_FUNCTION()
2283 sxe->iter.isprefix = isprefix; in PHP_FUNCTION()
2284 php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp); in PHP_FUNCTION()
2285 php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL); in PHP_FUNCTION()
2287 RETURN_OBJ(&sxe->zo); in PHP_FUNCTION()
2294 php_sxe_object *sxe; in PHP_FUNCTION() local
2336 sxe = php_sxe_object_new(ce, fptr_count); in PHP_FUNCTION()
2337 sxe->iter.nsprefix = ns_len ? (xmlChar*)estrdup(ns) : NULL; in PHP_FUNCTION()
2338 sxe->iter.isprefix = isprefix; in PHP_FUNCTION()
2339 php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp); in PHP_FUNCTION()
2340 php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL); in PHP_FUNCTION()
2342 RETURN_OBJ(&sxe->zo); in PHP_FUNCTION()
2349 php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); in PHP_METHOD() local
2378 ((php_libxml_node_object *)sxe)->document = NULL; in PHP_METHOD()
2383 sxe->iter.nsprefix = ns_len ? (xmlChar*)estrdup(ns) : NULL; in PHP_METHOD()
2384 sxe->iter.isprefix = isprefix; in PHP_METHOD()
2385 php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, docp); in PHP_METHOD()
2386 php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement(docp), NULL); in PHP_METHOD()
2402 static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data) /* {{{… in php_sxe_iterator_fetch() argument
2404 xmlChar *prefix = sxe->iter.nsprefix; in php_sxe_iterator_fetch()
2405 int isprefix = sxe->iter.isprefix; in php_sxe_iterator_fetch()
2407 if (sxe->iter.type == SXE_ITER_ATTRLIST) { in php_sxe_iterator_fetch()
2408 if (sxe->iter.name) { in php_sxe_iterator_fetch()
2411 if (!xmlStrcmp(node->name, sxe->iter.name) && match_ns(sxe, node, prefix, isprefix)) { in php_sxe_iterator_fetch()
2420 if (match_ns(sxe, node, prefix, isprefix)) { in php_sxe_iterator_fetch()
2427 } else if (sxe->iter.type == SXE_ITER_ELEMENT && sxe->iter.name) { in php_sxe_iterator_fetch()
2430 if (!xmlStrcmp(node->name, sxe->iter.name) && match_ns(sxe, node, prefix, isprefix)) { in php_sxe_iterator_fetch()
2439 if (match_ns(sxe, node, prefix, isprefix)) { in php_sxe_iterator_fetch()
2448 _node_as_zval(sxe, node, &sxe->iter.data, SXE_ITER_NONE, NULL, prefix, isprefix); in php_sxe_iterator_fetch()
2455 static xmlNodePtr php_sxe_reset_iterator_no_clear_iter_data(php_sxe_object *sxe, int use_data) in php_sxe_reset_iterator_no_clear_iter_data() argument
2458 GET_NODE(sxe, node) in php_sxe_reset_iterator_no_clear_iter_data()
2461 switch (sxe->iter.type) { in php_sxe_reset_iterator_no_clear_iter_data()
2471 ZEND_ASSERT(Z_ISUNDEF(sxe->iter.data)); in php_sxe_reset_iterator_no_clear_iter_data()
2473 return php_sxe_iterator_fetch(sxe, node, use_data); in php_sxe_reset_iterator_no_clear_iter_data()
2478 static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data) /* {{{ */ in php_sxe_reset_iterator() argument
2480 if (!Z_ISUNDEF(sxe->iter.data)) { in php_sxe_reset_iterator()
2481 zval_ptr_dtor(&sxe->iter.data); in php_sxe_reset_iterator()
2482 ZVAL_UNDEF(&sxe->iter.data); in php_sxe_reset_iterator()
2485 return php_sxe_reset_iterator_no_clear_iter_data(sxe, use_data); in php_sxe_reset_iterator()
2502 iterator->sxe = Z_SXEOBJ_P(object); in php_sxe_get_iterator()
2523 return Z_ISUNDEF(iterator->sxe->iter.data) ? FAILURE : SUCCESS; in php_sxe_iterator_valid()
2531 return &iterator->sxe->iter.data; in php_sxe_iterator_current_data()
2538 zval *curobj = &iterator->sxe->iter.data; in php_sxe_iterator_current_key()
2554 PHP_SXE_API void php_sxe_move_forward_iterator(php_sxe_object *sxe) /* {{{ */ in php_sxe_move_forward_iterator() argument
2559 if (!Z_ISUNDEF(sxe->iter.data)) { in php_sxe_move_forward_iterator()
2560 intern = Z_SXEOBJ_P(&sxe->iter.data); in php_sxe_move_forward_iterator()
2562 zval_ptr_dtor(&sxe->iter.data); in php_sxe_move_forward_iterator()
2563 ZVAL_UNDEF(&sxe->iter.data); in php_sxe_move_forward_iterator()
2567 php_sxe_iterator_fetch(sxe, node->next, 1); in php_sxe_move_forward_iterator()
2575 php_sxe_move_forward_iterator(iterator->sxe); in php_sxe_iterator_move_forward()
2579 PHP_SXE_API void php_sxe_rewind_iterator(php_sxe_object *sxe) /* {{{ */ in php_sxe_rewind_iterator() argument
2581 php_sxe_reset_iterator(sxe, 1); in php_sxe_rewind_iterator()
2587 php_sxe_object *sxe; in php_sxe_iterator_rewind() local
2590 sxe = iterator->sxe; in php_sxe_iterator_rewind()
2592 php_sxe_reset_iterator(sxe, 1); in php_sxe_iterator_rewind()
2598 php_sxe_object *sxe; in simplexml_export_node() local
2601 sxe = Z_SXEOBJ_P(object); in simplexml_export_node()
2602 GET_NODE(sxe, node); in simplexml_export_node()
2603 return php_sxe_get_first_node(sxe, node); in simplexml_export_node()
2610 php_sxe_object *sxe; in PHP_FUNCTION() local
2647 sxe = php_sxe_object_new(ce, fptr_count); in PHP_FUNCTION()
2648 sxe->document = object->document; in PHP_FUNCTION()
2649 php_libxml_increment_doc_ref((php_libxml_node_object *)sxe, nodep->doc); in PHP_FUNCTION()
2650 php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, nodep, NULL); in PHP_FUNCTION()
2652 RETURN_OBJ(&sxe->zo); in PHP_FUNCTION()