SimpleXML - parsing attributes with a namespace

From: Date: Fri, 03 Jun 2011 10:37:45 +0000
Subject: SimpleXML - parsing attributes with a namespace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-313328@lists.php.net to get a copy of this message
Hi, Using following code does not parse the "xml:id" attribute. If I change the attribute's namespace to anything other than "xml" ( e.g. "new:id" ) then it works. $string = <<<XML <TEI xml:id="decten1tlsg01"> <teiHeader> <profileDesc> <particDesc> <person xml:id="interviewerTlsg01"> </person> </particDesc> </profileDesc> </teiHeader> </TEI> XML; $xml = simplexml_load_string($string); foreach($xml->teiHeader->profileDesc->particDesc->person[0]->attributes() as $a => $b) { echo "<p>$a = $b \n</p>"; } Is this a bug? And how do I get this to work? Many thanks, Anthony

« previous php.general (#313328) next »