Hi fellow Flashers, I just wanted to get some help with XML manipulation.
I have the following code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
nDates = [];
nTitles = [];
nInfo = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
nDates* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
nTitles* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
nInfo* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
} else {
trace(“File not Loaded”);
}
trace(total);
trace(nDates[1]);
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“News.xml”);
=============
And, the following XML file:
<?xml version=“1.0” encoding=“iso-8859-1”?>
<News>
<NewsBlock>
<nDate>06-20-2005</nDate>
<nTitle>Got My iMac</nTitle>
<Info>My iMac Arrived, I’m so excited.</Into>
</NewsBlock>
<NewsBlock>
<nDate>06-17-2005</nDate>
<nTitle>Site Launched</nTitle>
<Info>Finally got my website up and running…its about time.</Into>
</NewsBlock>
</News>
Now, I’ve tried getting each node with the ‘for’ loop above, but it only extracts only one node.
Any Solutions?
Thanks for all your time.