# Need some help with xml Nodes in Flash

**URL:** <https://forum.kirupa.com/t/need-some-help-with-xml-nodes-in-flash/245577>\
**Category:** flash\
**Created:** [December 1, 2007, 5:44am UTC](https://forum.kirupa.com/t/need-some-help-with-xml-nodes-in-flash/245577 "2007-12-01T05:44:34Z")\
**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 1, 2007, 5:44am UTC](https://forum.kirupa.com/t/need-some-help-with-xml-nodes-in-flash/245577/1 "2007-12-01T05:44:34Z")

</div>

hi, i worked on this code earlier today 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]+"&lt;br&gt;"+currBody.firstChild.childNodes.nodeValue[0]+"&lt;br&gt;"+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!
