Lines Matching refs:node

136 	xmlNodePtr node = fragment->children;  in dom_fragment_assign_parent_node()  local
138 while (node != NULL) { in dom_fragment_assign_parent_node()
139 node->parent = parentNode; in dom_fragment_assign_parent_node()
141 if (node == fragment->last) { in dom_fragment_assign_parent_node()
144 node = node->next; in dom_fragment_assign_parent_node()
149 static bool dom_fragment_common_hierarchy_check_part(xmlNodePtr node, bool *seen_element) in dom_fragment_common_hierarchy_check_part() argument
152 xmlNodePtr iter = node->children; in dom_fragment_common_hierarchy_check_part()
172 bool php_dom_fragment_insertion_hierarchy_check_pre_insertion(xmlNodePtr parent, xmlNodePtr node, x… in php_dom_fragment_insertion_hierarchy_check_pre_insertion() argument
175 if (!dom_fragment_common_hierarchy_check_part(node, &seen_element)) { in php_dom_fragment_insertion_hierarchy_check_pre_insertion()
198 bool php_dom_fragment_insertion_hierarchy_check_replace(xmlNodePtr parent, xmlNodePtr node, xmlNode… in php_dom_fragment_insertion_hierarchy_check_replace() argument
201 if (!dom_fragment_common_hierarchy_check_part(node, &seen_element)) { in php_dom_fragment_insertion_hierarchy_check_replace()
237 …ut_step_1(php_libxml_ref_obj *document, xmlNodePtr parentNode, xmlNodePtr node, xmlNodePtr child, … in dom_is_pre_insert_valid_without_step_1() argument
245 if (node->doc != documentNode) { in dom_is_pre_insert_valid_without_step_1()
259 dom_hierarchy(parentNode, node) != SUCCESS in dom_is_pre_insert_valid_without_step_1()
261 || node->type == XML_ATTRIBUTE_NODE in dom_is_pre_insert_valid_without_step_1()
263 node->type == XML_ENTITY_REF_NODE in dom_is_pre_insert_valid_without_step_1()
264 || node->type == XML_ENTITY_NODE in dom_is_pre_insert_valid_without_step_1()
265 || node->type == XML_NOTATION_NODE in dom_is_pre_insert_valid_without_step_1()
266 || node->type == XML_DOCUMENT_NODE in dom_is_pre_insert_valid_without_step_1()
267 || node->type == XML_HTML_DOCUMENT_NODE in dom_is_pre_insert_valid_without_step_1()
268 || node->type >= XML_ELEMENT_DECL))) { in dom_is_pre_insert_valid_without_step_1()
275 if (parent_is_document && (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE)) { in dom_is_pre_insert_valid_without_step_1()
281 if (!parent_is_document && node->type == XML_DTD_NODE) { in dom_is_pre_insert_valid_without_step_1()
290 if (node->type == XML_DOCUMENT_FRAG_NODE) { in dom_is_pre_insert_valid_without_step_1()
291 if (!php_dom_fragment_insertion_hierarchy_check_pre_insertion(parentNode, node, child)) { in dom_is_pre_insert_valid_without_step_1()
296 else if (node->type == XML_ELEMENT_NODE) { in dom_is_pre_insert_valid_without_step_1()
308 else if (node->type == XML_DTD_NODE) { in dom_is_pre_insert_valid_without_step_1()
326 static void dom_free_node_after_zval_single_node_creation(xmlNodePtr node) in dom_free_node_after_zval_single_node_creation() argument
331 for (xmlNodePtr child = node->children; child != NULL; child = next) { in dom_free_node_after_zval_single_node_creation()
350 xmlNodePtr node = NULL; in dom_zvals_to_single_node() local
361 node = xmlNewDocTextLen(documentNode, BAD_CAST Z_STRVAL_P(nodes), Z_STRLEN_P(nodes)); in dom_zvals_to_single_node()
362 if (UNEXPECTED(node == NULL)) { in dom_zvals_to_single_node()
365 return node; in dom_zvals_to_single_node()
369 node = xmlNewDocFragment(documentNode); in dom_zvals_to_single_node()
370 if (UNEXPECTED(!node)) { in dom_zvals_to_single_node()
387 if (!dom_is_pre_insert_valid_without_step_1(document, node, newNode, NULL, documentNode)) { in dom_zvals_to_single_node()
403 dom_add_child_without_merging(node, newNode); in dom_zvals_to_single_node()
407 dom_add_child_without_merging(node, newNode); in dom_zvals_to_single_node()
419 dom_add_child_without_merging(node, newNode); in dom_zvals_to_single_node()
424 return node; in dom_zvals_to_single_node()
429 dom_free_node_after_zval_single_node_creation(node); in dom_zvals_to_single_node()
430 xmlFree(node); in dom_zvals_to_single_node()
486 static void dom_insert_node_list_cleanup(xmlNodePtr node) in dom_insert_node_list_cleanup() argument
488 if (node->_private != NULL) { in dom_insert_node_list_cleanup()
492 if (node->type == XML_DOCUMENT_FRAG_NODE) { in dom_insert_node_list_cleanup()
493 dom_free_node_after_zval_single_node_creation(node); in dom_insert_node_list_cleanup()
494 xmlFree(node); /* Don't free the children, now-empty fragment! */ in dom_insert_node_list_cleanup()
495 } else if (node->type == XML_TEXT_NODE) { in dom_insert_node_list_cleanup()
496 ZEND_ASSERT(node->parent == NULL); in dom_insert_node_list_cleanup()
497 xmlFreeNode(node); in dom_insert_node_list_cleanup()
500 ZEND_ASSERT(node->_private != NULL); in dom_insert_node_list_cleanup()
505 static void dom_insert_node_list_unchecked(php_libxml_ref_obj *document, xmlNodePtr node, xmlNodePt… in dom_insert_node_list_unchecked() argument
509 if (node->type == XML_DOCUMENT_FRAG_NODE) { in dom_insert_node_list_unchecked()
512 xmlNodePtr newchild = node->children; in dom_insert_node_list_unchecked()
516 xmlNodePtr last = node->last; in dom_insert_node_list_unchecked()
518 dom_fragment_assign_parent_node(parent, node); in dom_insert_node_list_unchecked()
528 if (node->_private == NULL) { in dom_insert_node_list_unchecked()
529 xmlFree(node); in dom_insert_node_list_unchecked()
531 node->children = NULL; in dom_insert_node_list_unchecked()
532 node->last = NULL; in dom_insert_node_list_unchecked()
537 if (insertion_point == node) { in dom_insert_node_list_unchecked()
538 insertion_point = node->next; in dom_insert_node_list_unchecked()
542 xmlUnlinkNode(node); in dom_insert_node_list_unchecked()
543 php_dom_pre_insert_helper(insertion_point, parent, node, node); in dom_insert_node_list_unchecked()
544 node->parent = parent; in dom_insert_node_list_unchecked()
545 if (parent->doc && node->type == XML_DTD_NODE) { in dom_insert_node_list_unchecked()
546 parent->doc->intSubset = (xmlDtdPtr) node; in dom_insert_node_list_unchecked()
547 node->parent = (xmlNodePtr) parent->doc; in dom_insert_node_list_unchecked()
550 dom_reconcile_ns(parent->doc, node); in dom_insert_node_list_unchecked()
557 bool php_dom_pre_insert(php_libxml_ref_obj *document, xmlNodePtr node, xmlNodePtr parent, xmlNodePt… in php_dom_pre_insert() argument
559 if (UNEXPECTED(node == NULL)) { in php_dom_pre_insert()
564 if (dom_is_pre_insert_valid_without_step_1(document, parent, node, insertion_point, parent->doc)) { in php_dom_pre_insert()
565 dom_insert_node_list_unchecked(document, node, parent, insertion_point); in php_dom_pre_insert()
568 dom_insert_node_list_cleanup(node); in php_dom_pre_insert()
574 void php_dom_node_append(php_libxml_ref_obj *document, xmlNodePtr node, xmlNodePtr parent) in php_dom_node_append() argument
576 php_dom_pre_insert(document, node, parent, NULL); in php_dom_node_append()
591 xmlNodePtr node = dom_zvals_to_single_node(context->document, parentNode, nodes, nodesc); in dom_parent_node_append() local
592 if (UNEXPECTED(node == NULL)) { in dom_parent_node_append()
597 php_dom_node_append(context->document, node, parentNode); in dom_parent_node_append()
617 xmlNodePtr node = dom_zvals_to_single_node(context->document, parentNode, nodes, nodesc); in dom_parent_node_prepend() local
618 if (UNEXPECTED(node == NULL)) { in dom_parent_node_prepend()
623 php_dom_pre_insert(context->document, node, parentNode, parentNode->children); in dom_parent_node_prepend()
756 xmlNodePtr node = dom_zvals_to_single_node(context->document, parentNode, nodes, nodesc); in dom_child_replace_with() local
757 if (UNEXPECTED(node == NULL)) { in dom_child_replace_with()
762 …if (dom_is_pre_insert_valid_without_step_1(context->document, parentNode, node, viable_next_siblin… in dom_child_replace_with()
765 if (child->parent != node) { in dom_child_replace_with()
769 dom_insert_node_list_unchecked(context->document, node, parentNode, viable_next_sibling); in dom_child_replace_with()
771 dom_insert_node_list_cleanup(node); in dom_child_replace_with()
787 xmlNodePtr node = dom_zvals_to_single_node(context->document, thisp, nodes, nodesc); in dom_parent_node_replace_children() local
788 if (UNEXPECTED(node == NULL)) { in dom_parent_node_replace_children()
793 if (dom_is_pre_insert_valid_without_step_1(context->document, thisp, node, NULL, thisp->doc)) { in dom_parent_node_replace_children()
795 php_dom_pre_insert(context->document, node, thisp, NULL); in dom_parent_node_replace_children()
797 dom_insert_node_list_cleanup(node); in dom_parent_node_replace_children()