Rob Richards wrote:
Due to the internals of the DOM extension, you need to register the
class types that are actually instantiated and not the underlying base
DOMNode class. Unfortunately in your case this means you need to
register all of those classes separately.
$dom->registerNodeClass('DOMElement','MyDOMNode');
$dom->registerNodeClass('DOMAttr','MyDOMNode');
$dom->registerNodeClass('DOMText','MyDOMNode');
...
Not good... :-(
<?php
class MyDOMNode extends DOMNode {
public $x = 100;
}
$dom = new DOMDocument();
$dom->registerNodeClass('DOMElement','MyDOMNode');
?>
PHP Fatal error: DOMDocument::registerNodeClass(): Class MyDOMNode is
not derived from DOMElement.
So I have to extend DOMElement and register MyDOMElement. But all my
nodes should be also based on MyDOMNode.
Problem is that in PHP you can only extend one class in a time, so you
cannot build your own class-tree which extends a base class-tree of DOM. :-/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php