spelltwister
Programmer
Hey all,
I'm having a hard time finding any examples of parsing XML that has attributes.
Here's the xml:
<units>
<persiancamp unit="infantry" number="8" owner="persian" ranged="0" />
<persiancamp unit="xerxes" number="1" owner="persian" ranged="0" />
<m1 unit="sInfantry" number="1" owner="persian" ranged="1" />
<...>
</units>
I have an array with all possible tag names and I need to be able to do something like this:
$array = array('persiancamp','m1'...);
for($i=0;$i<sizeof($array);$i++){
//CYCLE THROUGH XML FINDING IF TAGS MATCH CURRENT ARRAY VALUE, GATHER ALL ATTRIBUTE INFORMATION
}
Any help, or links to tutorials are much appreciated.
Thanks!
Mike
Online multiplayer strategy games huh? Try, 1483online.com where the games are FREE and the community drives enhancements to the game. ;-D
I'm having a hard time finding any examples of parsing XML that has attributes.
Here's the xml:
<units>
<persiancamp unit="infantry" number="8" owner="persian" ranged="0" />
<persiancamp unit="xerxes" number="1" owner="persian" ranged="0" />
<m1 unit="sInfantry" number="1" owner="persian" ranged="1" />
<...>
</units>
I have an array with all possible tag names and I need to be able to do something like this:
$array = array('persiancamp','m1'...);
for($i=0;$i<sizeof($array);$i++){
//CYCLE THROUGH XML FINDING IF TAGS MATCH CURRENT ARRAY VALUE, GATHER ALL ATTRIBUTE INFORMATION
}
Any help, or links to tutorials are much appreciated.
Thanks!
Mike
Online multiplayer strategy games huh? Try, 1483online.com where the games are FREE and the community drives enhancements to the game. ;-D