Hello everybody,
I’m trying on defining the attributes for an XML page…, can you help me out?, my real problem is that I dont know how to call an specific value from a single tag with values inside its own. For Example:
<tagName1 value1=“1” value2=“2” value3=“3”>
<tagName2 value4=“4”>ACTUALLY NOTHING HERE</tagName2>
</tagName1>
How can I obtain value1, value2, value3 and value4?
My other question is how to define attributes?
The atrributes I want to define are:
*weekNumber
*matchupID
*secondsRemaining
*teamID
*home
*score
My XML look this way:
[AS]
<?xml version=“1.0” encoding=“ISO-8859-1”?>
<nflSchedule week=“17”>
−
<matchup kickoff=“1230487200” gameSecondsRemaining=“0”>
<team id=“NEP” isHome=“0” score=“13” rushDefenseRank=“14” passDefenseRank=“11” rushOffenseRank=“6” passOffenseRank=“12”/>
<team id=“BUF” isHome=“1” score=“0” rushDefenseRank=“21” passDefenseRank=“13” rushOffenseRank=“14” passOffenseRank=“22”/>
</matchup>
−
<matchup kickoff=“1230487200” gameSecondsRemaining=“0”>
<team id=“TEN” isHome=“0” score=“0” rushDefenseRank=“6” passDefenseRank=“9” rushOffenseRank=“7” passOffenseRank=“27”/>
<team id=“IND” isHome=“1” score=“23” rushDefenseRank=“23” passDefenseRank=“6” rushOffenseRank=“31” passOffenseRank=“5”/>
</matchup>
−
<matchup kickoff=“1230487200” gameSecondsRemaining=“0”>
<team id=“KCC” isHome=“0” score=“6” rushDefenseRank=“29” passDefenseRank=“28” rushOffenseRank=“16” passOffenseRank=“20”/>
<team id=“CIN” isHome=“1” score=“16” rushDefenseRank=“20” passDefenseRank=“15” rushOffenseRank=“29” passOffenseRank=“30”/>
</matchup>
</nflSchedule>
[/AS]
So:
*The weekNumber attribute is the inside value #1 of the tag at the top “nflSchedule” which is at level “this.firstChild”.
*The matchupID attribute is the inside value #1 of the second tag “matchup” which is at level “this.firstChild.childNodes[matchup]”.
*The secondsRemaining attribute is the inside value #2 of the second tag “matchup” which is at level “this.firstChild.childNodes[matchup]”.
*The teamID attribute is the inside value #1 of the second tag “matchup” which is at level “this.firstChild.childNodes[matchup].childNodes[team]”.
*The home attribute is the inside value #2 of the second tag “matchup” which is at level “this.firstChild.childNodes[matchup].childNodes[team]”.
*The score attribute is the inside value #3 of the second tag “matchup” which is at level “this.firstChild.childNodes[matchup].childNodes[team]”.
My third question would be how should the attributes be define to the easy acces of information?
For example, I want to know the score at Miami’s game so --> if (matchupID.teamId == “MIA”){
trace (matchupID.score.value)
}
Or something like that…
THANKS A LOT, IF YOU HAVE TROUBLE SOMETHING OF YOUR OWN JUST LET ME KNOW!
Cheers,
Ariel