# Need some help with calling xml nodes

**URL:** <https://forum.kirupa.com/t/need-some-help-with-calling-xml-nodes/245732>\
**Category:** Uncategorized\
**Created:** [December 3, 2007, 2:34pm UTC](https://forum.kirupa.com/t/need-some-help-with-calling-xml-nodes/245732 "2007-12-03T14:34:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icebot07](https://avatars.discourse-cdn.com/v4/letter/i/e99b99/32.png) [@icebot07](https://forum.kirupa.com/u/icebot07)\
**Post date:** [December 3, 2007, 2:34pm UTC](https://forum.kirupa.com/t/need-some-help-with-calling-xml-nodes/245732/1 "2007-12-03T14:34:46Z")

</div>

hi, i worked on this code friday and had saved it as version 8, but when i got home i couldn’t open it. so…i tried to recreate it from memory, which is always a bad idea for a sleep-deprived mommy 😉

here’s my actionscript code:

var blocks:Array = new Array(txt0,txt1,txt2);  
var stories:Array = new Array();

var headlineXML:XML = new XML();  
headlineXML.ignoreWhite = true;  
headlineXML.onLoad = function(success){

if (success){  
parse();  
trace(this);  
}  
}

headlineXML.load(“headlines2.xml”);

function parse() {  
var broadcastXML = headlineXML.firstChild;  
var storyNode = broadcastXML.childNodes;

for (var i=0; i\<storyNode.childNodes.length; i++){

```
currStories = stories*;
currLead = storyNode.firstChild.childNodes[0];
currBody = storyNode.firstChild.childNodes[1];
currURL = storyNode.firstChild.childNodes[2];
currtxt = blocks*;

```

currtxt.htmlText = currLead.firstChild.childNodes.nodeValue[0]+"\<br\>"+currBody.firstChild.childNodes.nodeValu e[0]+"\<br\>"+currURL.firstChild.childNodes.nodeValue[0];  
}  
}

and here’s my xml doc structure:

\<broadcast\>  
\<story\>  
\<lead\>This is Headline 1\</lead\>  
\<body\>This is where you can add content that will appear under the first headline\</body\>  
\<URL\>\<a href="[http://www.nytimes.com](http://www.nytimes.com)"\>[www.nytimes.com](http://www.nytimes.com)\</a\>\</URL\>  
\</story\>  
\<story\>  
\<lead\>This is Headline 2\</lead\>  
\<body\>This is where you can add content that will appear under the second headline\</body\>  
\<URL\>[http://evanchik.net](http://evanchik.net)\</URL\>  
\</story\>  
\<story\>  
\<lead\>This is Headline 3\</lead\>  
\<body\>This is where you can add content that will appear under the third headline\</body\>  
\<URL\>[http://www.kirupa.com](http://www.kirupa.com)\</URL\>  
\</story\>  
\</broadcast\>

any help would be appreciated…i’m getting nowhere and i need to get this well underway by the end of the weekend. i also need to load images and style the text, but for now i just want it to loop thru the text arrays properly. _sigh_ and to show my text!

thanks!
