Beware if you're working with classes you've extended from DOMNode, DOMElement, etc.
Calling importNode() with an object of your derived class will result in the copy being an instance of the DOM super class.
You will *not* get a copy of the derived class or any of its properties or methods.
For example:
<?
class extDOMElement extends DOMElement {
function __construct($name, $value='', $namespaceURI=null) {
parent::__construct($name, $value, $namespaceURI);
}
}
class extDOMDocument extends DOMDocument {
public function createElement($name, $value) {
$orphan = new extDOMElement($name, $value);
$adopt = $this->importNode($orphan, true);
return $adopt; }
}
$doc = new extDOMDocument();
$el = $doc->createElement('tagName');
echo 'Element instanceof '.get_class($el);
?>
Will display "Element instanceof DOMElement" rather than the expected "extDOMElement"