note 69103 rejected from function.dom-domxpath-evaluate by bjori

From: Date: Wed, 23 Aug 2006 08:49:05 +0000
Subject: note 69103 rejected from function.dom-domxpath-evaluate by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116220@lists.php.net to get a copy of this message
Note Submitter: kamnev at teratology dot ru ---- Hello everybody! I've got a problem here... Does anybody know how to get the text() value through Xpath evaluate? Every time I'm trying to get the string value evaluate returns DOMNodeList <? // simple xml (without headers) <rootElement> <module> <name>somemodule</name> </module> </rootElement> // And a PHP-code to get 'somemodule': $doc = new DOMDocument; $doc->loadXML($someModuleXML); $xpath = new DOMXPath($doc); $root = $doc->firstChild; $result = $xpath->evaluate('module/name/text()', $root); /* So, result is DOMNodeList and I can get the string value through $result->item(0)->nodeValue */ ?> And the question is - how to get right string result, not DOMNodeList?

« previous php.notes (#116220) next »