function &setRootNode(&$node) { if (XMLNode::validClass($node)) { $node->setDocument($this); $node->node_level = 0; $this->root_node =& $node; } return $this->root_node; }
function &appendChild(&$newChild) { //Appends the node newChild at the end of the child nodes for this node if (XMLNode::validClass($newChild)) { // set current document $newChild->node_level = $this->node_level + 1; $newChild->setDocument($this->getDocument()); // no child if (!isset($this->child)) { $newChild->parent_node =& $this; $this->child =& $newChild; } else { // get last child $child =& $this->child; while (isset($child->sibling)) { $child =& $child->sibling; } $newChild->parent_node =& $this; $newChild->previous_sibling =& $child; $child->sibling =& $newChild; } } return $newChild; }