function set_content($text) { // the following replace has been added to conform with PHP4. // A set_content("&") brought a get_content() = "&" there, // whereas PHP5 gives a get_content() = "&" $text = str_replace("<", "<", $text); $text = str_replace(">", ">", $text); $text = str_replace("&", "&", $text); $text_node = new DOMText(); $text_node->appendData($text); if (is_object($this->myDOMNode->firstChild)) { $this->myDOMNode->replaceChild($text_node, $this->myDOMNode->firstChild); } else { $this->myDOMNode->appendChild($text_node); } }