public function &appendNode(DOMNode &$a_tag) { switch ($this->m_node->nodeType) { case XML_DOCUMENT_NODE: $node = $this->m_node->isSameNode($a_tag->ownerDocument) ? $a_tag : $this->m_node->importNode($a_tag, true); $this->m_node->appendChild($a_tag); return $this; case XML_ELEMENT_NODE: $node = $this->m_node->ownerDocument->isSameNode($a_tag->ownerDocument) ? $a_tag : $this->m_node->ownerDocument->importNode($a_tag, true); $this->m_node->appendChild($node); return $this; } return $this; }