ID: 34413 Updated by: [EMAIL PROTECTED] Reported By: thisisroot at gmail dot com -Status: Feedback +Status: Bogus Bug Type: XML related Operating System: Mac OS 10.4.2 PHP Version: 5.0.5 New Comment:
your xpath query is not relative. Use $key = $xpath->query( './/key', $node); and it works And please provide a really self runnning example next time, we're mostly not in the mood to make your examples running on our computers.. Previous Comments: ------------------------------------------------------------------------ [2005-09-07 23:44:36] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-09-07 22:07:24] thisisroot at gmail dot com Description: ------------ DOMXPath->query() seems to totally ignore context nodes. I get an empty DOMNodeList when I execute a query with a context node. P.S.: Your bug submission process is a real PITA. Could we have just one CAPTCHA, please? Reproduce code: --------------- // I just deleted the real code, but here's a sample // Assume the document and xpath parser have already been // instantiated. /* $doc = <kvps> <string> <key>My Key</key> <value>My Value</value> <string> </kvps> */ $nodes = $xpath->query( '//string'); foreach ( $nodes as $node) { print_r( $node); $key = $xpath->query( '//key', $node); echo $key->nodeValue . "\n"; print_r( $key); } Expected result: ---------------- I expect $key to be the DOMElement tagged as "key" inside of the current "string" element. Actual result: -------------- An empty NodeList ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34413&edit=1