PHP5/DOM: XPath Implementation

From: Date: Thu, 30 Sep 2004 19:08:24 +0000
Subject: PHP5/DOM: XPath Implementation
Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-471@lists.php.net to get a copy of this message
i've a question about XPath processing in PHP5 with the new DOM implementation: ok, this is the introducing, simple script: <?php class MyElem extends DOMElement { ... function getChildNodes() { print("MyElem Func"); ... } } class MyDoc extends DOMDocument { ... function createElement(...) { return new MyElem(...); } ... } $doc = new MyDoc(); $xp = new DOMXPath($doc); $xp->query("/child/*[@attr = '']"); ... ?> Short summary of the script: - extend DOMElement, DOMDocument by own classes, we want to have our own methods like MyElem::getChildNodes() and MyElem::getAttribute(). - instanciate new doc and initialise an xpath-object for it - execute an xpath and later on process the result... now my question: am i right that the xpath processor won't use the MyElem::getChildNodes() or MyElem::getAttribute() to get the right nodes for the result? i think the processor would choose the internal libxml function to traverse through the dom tree. thus, seems to me that all dom (C) functions are statically bound and not dynamically at runtime like methods of dynamically built php objects. otherwise the output of the MyElem::getChildNodes() func in the expample above would be "MyElem Func"? So, once again: please enlighten me... Thanks, vivi

« previous php.xml.dev (#471) next »