Hi,
How to parse the following type of xml
I tried to use the following php code but it is not working for me
please can any one help me in solving this
Thanks in Advance
Ram
How to parse the following type of xml
Code:
$xml = '<?xml version="1.0"?> <a:multistatus xmlns:b="urn:uuid:c400-xsall/" xmlns:e="urn:schemas:httpmail:" xmlns:c="xml:" xmlns:d="urn:schemas:calendar:" xmlns:a="DAV:"> <a:response> <a:href>http://testserver/exchange/test/calendar/testmail</a:href> <a:propstat> <a:status>HTTP/1.1 200 OK</a:status> <a:prop> <d:location>Test Location</d:location> <e:subject>Test Subject</e:subject> <d:dtstart b:dt="dateTime.tz">2010-12-13T07:00:00.000Z</d:dtstart> <d:dtend b:dt="dateTime.tz">2010-12-13T08:00:00.000Z</d:dtend> <d:busystatus>BUSY</d:busystatus> <d:instancetype b:dt="int">2</d:instancetype> <a:displayname>Test Name</a:displayname> </a:prop> </a:propstat> </a:response> </a:multistatus>';
Code:
$dom = new DOMDocument;
$dom->loadXML(utf8_encode($xml));
foreach ($dom->getElementsByTagNameNS('urn:schemas:httpmail:', '*') as $response){
$subjec = $response->getElementsByTagName("subject");
echo "<br/>Display Name=".$subject = $subjec->item(0)->nodeValue;
}
Thanks in Advance
Ram
Comment