SimpleXml with namespace

gkindlcrows

New Member
I have a question. How can i print with php the stored data from my xmlMy Xml is:\[code\]<?xml version="1.0" encoding="utf-8"?> <DataSet xmlns="*******"> ......... <diffgr:diffgram xmlns:msdata="http://stackoverflow.com/questions/11309786/urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <dsAanbodMakelaar> <Pand diffgr:id="Pand1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> <PandID>231384</PandID> .....................\[/code\]So how could i get the data from \[code\]<PandID>\[/code\]I thought to write my php script as follow:\[code\]<?php$feed = file_get_contents("1.xml");$xml = new SimpleXmlElement($feed);foreach( $xml as $entry ) { //Use that namespace $namespaces = $entry->getNameSpaces(true); //Now we don't have the URL hard-coded $diffgr = $entry->children($namespaces['diffgr']); echo $diffgr->diffgram->dsAanbodMakelaar->Pand;} ?>\[/code\]How could i get this to work?
 
Back
Top