Hi,

I want to add some functionality to all classes derived from DOMNode.
I tried:

<?php
class MyDOMNode extends DOMNode {
        public $v = 10;
        function __construct() {}
}

$dom = new DOMDocument();
$dom->registerNodeClass('DOMNode','MyDOMNode');

$dom->loadXML('<root><a/></root>');
echo $dom->firstChild->v;  #<-- not outputs 10
?>

But I get the notice:
PHP Notice:  Undefined property:  DOMElement::$v in ...

I want the extension to be valid for all DOM nodes that are derived from DOMNode, such as DOMElement, DOMAttr, DOMNodeList, DOMText, etc...
I try not to extend all the classes one by one.

How can I do that?

-thanks, Eli

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to