# Xml targeting elements

**URL:** https://forum.kirupa.com/t/xml-targeting-elements/267841
**Category:** Uncategorized
**Created:** [August 6, 2008, 12:40pm UTC](https://forum.kirupa.com/t/xml-targeting-elements/267841 "2008-08-06T12:40:19Z")
**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: [August 6, 2008, 12:40pm UTC](https://forum.kirupa.com/t/xml-targeting-elements/267841/1 "2008-08-06T12:40:19Z")

</div>

having some problems trying to get some xml to display in text boxes in flash.

here’s the xml

```auto
<?xml version="1.0" ?>
<namesandtitles>

	<person>
		<name>Andrew</name>
		<title>Worker</title>
	</person>
	
</namesandtitles>

```

and now the as

```auto

function CreateTitles(the_xml){
	
	var items = the_xml.firstChild.firstChild; 

	for (var i=0; i<items.length; i++) {

			
			var persons_name = items*.firstChild;
			var persons_title = items*.childNodes[1];
			trace(persons_title);

			name_txt.text = persons_name.firstChild.nodeValue;
			title_txt.text = persons_title.firstChild.nodeValue;

	}
}

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

titles_xml.onLoad = function(success){
	if (success) CreateTitles(this);
	else trace("Error loading XML file");
}
// load the xml file!
titles_xml.load("names_titles.xml");

```

Is there a way to simplify this or target differently? Right now i’m getting nothing.  
I just want the data to show up in my two text boxes.

Thanks!
