My xml tag format is
<transcript>
<messages>
<message>
<to>user1@localhost.local</to>
<from>user2@localhost.local</from>
<body>hello</body>
<date>2014-09-09 14:14:17.652 IST</date>
</message>
<message>
<to>user2@localhost.local</to>
<from>user1@localhost.local</from>
<body>hi dear</body>
<date>2014-09-10 14:14:17.652 IST</date>
</message>
</messages>
</transcript>
I want to load This xml file and display result in format like
2014-09-09 - Tuesday
(2:14 PM ) user1 : hello
2014-09-10 - Wednesday
(2:14 PM )user2 : hi dear
I have tried this PHP code
$xml_file_path='filename_with_path';
$XMLReader->open($xml_file_path);
while ($XMLReader->read() && $XMLReader->name !== "transcript");
while ($XMLReader->read() && $XMLReader->name !== "messages");
while ($XMLReader->read() && $XMLReader->name !== "message");
while ($XMLReader->name === "message") {
$node = new SimpleXMLElement($XMLReader->readOuterXML());
}
but $node give me empty result,How can I fix it or where I am wrong.