Hey
I was going through tthe Displaying from a XML file tutorial. And i’ve understood the concept of nodes and levels.
I was experiementing with it and I wanted to display an RSS feed from a site to make it the way its supposed to be viewed.
This is the current code I have
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[8].childNodes[2].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[8].childNodes[0].firstChild.nodeValue;
_root.link = this.firstChild.childNodes[0].childNodes[8].childNodes[2].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
getURL(_root.link);
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml");
It works to some extent. Except I have a few questions now.
If the above AS is used in the XML tutorial it kinda works. Displays a heading and as such. However, Id like to know
1- How do i link a piece of text in XML? I want to link the title to its respective link.
2- Is there a way of looping or using an IF statement so that I could display all the titles from the nodes which have the name “title” ?
All help appreciated
Thanks