# Targetting my XML wrong?

**URL:** <https://forum.kirupa.com/t/targetting-my-xml-wrong/240271>\
**Category:** Uncategorized\
**Created:** [October 1, 2007, 2:41pm UTC](https://forum.kirupa.com/t/targetting-my-xml-wrong/240271 "2007-10-01T14:41:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dru\_nasty](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dru\_nasty](https://forum.kirupa.com/u/dru_nasty)\
**Post date:** [October 1, 2007, 2:41pm UTC](https://forum.kirupa.com/t/targetting-my-xml-wrong/240271/1 "2007-10-01T14:41:12Z")

</div>

Here’s my as

```auto

var news_xml = new XML();
news_xml.ignoreWhite = true;

news_xml.onLoad = function(success){
	if (success) createNews(this);
	else trace("Error loading XML file"); 
}
// load the xml
news_xml.load("news.xml");

function createNews(newsXML){
	// start with the first item in the XML
	var items = newsXML.firstChild.firstChild.childNodes; 
	for (var i=0; i<items.length; i++) {

			var story = items*.firstChild; // same as items*.childNodes[0]
			var date = items*.childNodes[1]; // second child node
			
			news_txt.htmlText = date.nodeValue +"<br><br>"+ story.nodeValue;
			trace(i);
			
	}
}

```

And then my XML

```auto
<?xml version="1.0" encoding="ISO-8859-1"?>
<news_story>
	<entry>
		<story>
		<![CDATA[Here is the first news story.]]>
		</story>
		<date>1191124800</date>
	</entry>
	<entry>
		<story>
		<![CDATA[Another news posting.]]>
		</story>
		<date>1191038400</date>
	</entry>
</news_story>

```

In my text area it shows only this:  
undefined

1191124800

So the date value should be shown first (based on my code) but it’s shown second. And I guess what is suppose to be the story is shown as undefined. On top of that, it seems my loop isn’t going through all the items in the XML.
