note 91538 added to domxpath.registernamespace

From: Date: Tue, 16 Jun 2009 07:01:38 +0000
Subject: note 91538 added to domxpath.registernamespace
Groups: php.notes 
Request: Send a blank email to php-notes+get-156907@lists.php.net to get a copy of this message
The following code can work for XML default namespace. <?php $xml = <<<EOT <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:other="http://other.w3.org/other" > <id>uYG7-sPwjFg</id> <published>2009-05-17T18:29:31.000Z</published> </entry> EOT; $doc = new DOMDocument; $doc->loadXML($xml); $xpath = DOMXPath($doc); $xpath->registerNamespace('atom', "http://www.w3.org/2005/Atom"); $xpath_str = '//atom:entry/atom:published/text()'; $entries = $xpath->evaluate($xpath_str); print $entries->item(0)->nodeValue ."\n"; ?> ---- Server IP: 221.194.139.225 Probable Submitter: 210.82.35.237 ---- Manual Page -- http://www.php.net/manual/en/domxpath.registernamespace.php Edit -- https://master.php.net/note/edit/91538 Del: integrated -- https://master.php.net/note/delete/91538/integrated Del: useless -- https://master.php.net/note/delete/91538/useless Del: bad code -- https://master.php.net/note/delete/91538/bad+code Del: spam -- https://master.php.net/note/delete/91538/spam Del: non-english -- https://master.php.net/note/delete/91538/non-english Del: in docs -- https://master.php.net/note/delete/91538/in+docs Del: other reasons-- https://master.php.net/note/delete/91538 Reject -- https://master.php.net/note/reject/91538 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156907) next »