note 107541 added to simplexmlelement.getnamespaces

From: Date: Thu, 16 Feb 2012 12:50:28 +0000
Subject: note 107541 added to simplexmlelement.getnamespaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-186164@lists.php.net to get a copy of this message
To read a namespace node you have to use the children method. <?php $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test"> <p:person id="1">John Doe</p:person> <p:person id="2">Susie Q. Public</p:person> </people> XML; $sxe = new SimpleXMLElement($xml); $ns = $sxe->getNamespaces(true); $child = $sxe->children($ns['p']); foreach ($child->person as $out_ns) { echo $out_ns; } ?> ---- Server IP: 92.48.74.199 Probable Submitter: 94.192.243.26 ---- Manual Page -- http://www.php.net/manual/en/simplexmlelement.getnamespaces.php Edit -- https://master.php.net/note/edit/107541 Del: integrated -- https://master.php.net/note/delete/107541/integrated Del: useless -- https://master.php.net/note/delete/107541/useless Del: bad code -- https://master.php.net/note/delete/107541/bad+code Del: spam -- https://master.php.net/note/delete/107541/spam Del: non-english -- https://master.php.net/note/delete/107541/non-english Del: in docs -- https://master.php.net/note/delete/107541/in+docs Del: other reasons-- https://master.php.net/note/delete/107541 Reject -- https://master.php.net/note/reject/107541 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186164) next »