/** * Add an XML string to the current node. * * @param string $tree * @return XMLNode * The newly created node object */ function add_node_tree($tree) { $xdoc = new \DOMDocument('1.0', $this->owner->encoding()); $xdoc->preserveWhiteSpace = false; $xdoc->loadXML($tree); $t = $this->doc->importNode($xdoc->firstChild, true); $n = clone $this; $n->node = $this->node ? $this->node->appendChild($t) : $this->doc->appendChild($t); unset($xdoc, $tree, $t); return $n; }