I'm just learning about the XmlReader Class and I've been racking my brain on this for quite some time and just cant seem to get anywhere because I don't know the proper way to do so..
I'm trying to read the xml using the XmlReader Class but I would also like to order the events by date, if possible, and then display them as html..
Here is a small example of what I'm looking for:
XML
PHP
Desired output HMTL:
Thanks!!
I'm trying to read the xml using the XmlReader Class but I would also like to order the events by date, if possible, and then display them as html..
Here is a small example of what I'm looking for:
XML
Code:
<?xml version="1.0" encoding="UTF-8"?> <Date TEXT="Wed, Jan 13, 10"> <Event GAME="Hockey"> <Competitor NAME="TEAM 1"></Competitor> <Competitor NAME="TEAM 2"></Competitor> <Time TEXT="9:05p EST"/> </Event> <Event GAME="Hockey"> <Competitor NAME="TEAM 3"></Competitor> <Competitor NAME="TEAM 4"></Competitor> <Time TEXT="8:05p EST"/> </Event> </Date>
Code:
<?php
$xml = new XMLReader();
$xml->open('test.xml');
while ($xml->read()) {
// what's the best way to do this??
}
$xml->close();
?>
Code:
<b>Wed, Jan 13, 10 at 8:05p EST</b><br /> TEAM 3<br /> TEAM 4<br /> <hr> <b>Wed, Jan 13, 10 at 9:05p EST</b><br /> TEAM 1<br /> TEAM 2<br /> <hr>
Comment