milesf
11-25-2008, 08:45 PM
My XML file is:
<report>
<beach name="East Coast" region="Northland">
<date>
<year>2008</year>
<month>11</month>
<day>25</day>
<time>07:28</time>
</date>
<highTide>18:45</highTide>
<lowTide>12:45</lowTide>
<swellSize>SE 3-4 ft Easing</swellSize>
<windDirection>NW</windDirection>
<windStrength>Fresh</windStrength>
</beach>
</report>
My ActionScript is::confused:
surfcoXML = new XML();
surfcoXML.load("newzealand_new2.xml");
surfcoXML.ignoreWhite = true;
surfcoXML.onLoad = extractData;
function extractData(success){
rootHandler=this.firstChild.childNodes; // First level - <report>
nodeHandler=rootHandler[0].childNodes; // Second level - <beach>
source=nodeHandler[0].firstChild.nodeValue;
for(i=0;i<=nodeHandler.length;i++){
if(nodeHandler[i].nodeName == "East Coast"){
childHandler=nodeHandler[i].childNodes;
highTide = childHandler[1].firstChild.nodeValue;
addfeed += "+ highTide + ";
}
}
xmlfeed=addfeed;
}
What have I done wrong?! I would like the xmlfeed to display the highTide value from my xml file.....
<report>
<beach name="East Coast" region="Northland">
<date>
<year>2008</year>
<month>11</month>
<day>25</day>
<time>07:28</time>
</date>
<highTide>18:45</highTide>
<lowTide>12:45</lowTide>
<swellSize>SE 3-4 ft Easing</swellSize>
<windDirection>NW</windDirection>
<windStrength>Fresh</windStrength>
</beach>
</report>
My ActionScript is::confused:
surfcoXML = new XML();
surfcoXML.load("newzealand_new2.xml");
surfcoXML.ignoreWhite = true;
surfcoXML.onLoad = extractData;
function extractData(success){
rootHandler=this.firstChild.childNodes; // First level - <report>
nodeHandler=rootHandler[0].childNodes; // Second level - <beach>
source=nodeHandler[0].firstChild.nodeValue;
for(i=0;i<=nodeHandler.length;i++){
if(nodeHandler[i].nodeName == "East Coast"){
childHandler=nodeHandler[i].childNodes;
highTide = childHandler[1].firstChild.nodeValue;
addfeed += "+ highTide + ";
}
}
xmlfeed=addfeed;
}
What have I done wrong?! I would like the xmlfeed to display the highTide value from my xml file.....