20 static function changeName($node, $name, $keep_attributes =
true)
22 $newnode = $node->ownerDocument->createElement($name);
24 foreach ($node->childNodes as $child)
26 $child2 = $child->cloneNode(
true);
27 $newnode->appendChild($child2);
31 foreach ($node->attributes as $attrName => $attrNode)
33 $newnode->setAttribute($attrName, $attrNode);
36 $node->parentNode->replaceChild($newnode, $node);
49 $newnode = $node->ownerDocument->createElement($name);
52 $par = $node->parentNode;
55 if ($next_sib = $node->nextSibling)
57 $newnode = $par->insertBefore($newnode, $next_sib);
61 $newnode = $par->appendChild($newnode);
64 $node = $par->removeChild($node);
65 $newnode->appendChild($node);
84 foreach ($node->childNodes as $child)
86 $child2 = $child->cloneNode(
true);
87 $node->parentNode->insertBefore($child2, $node);
89 $node->parentNode->removeChild($node);