# Displaying xml in text field

**URL:** <https://forum.kirupa.com/t/displaying-xml-in-text-field/318352>\
**Category:** flash\
**Created:** [January 18, 2011, 12:46am UTC](https://forum.kirupa.com/t/displaying-xml-in-text-field/318352 "2011-01-18T00:46:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![art\_i\_choke](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@art\_i\_choke](https://forum.kirupa.com/u/art_i_choke)\
**Post date:** [January 18, 2011, 12:46am UTC](https://forum.kirupa.com/t/displaying-xml-in-text-field/318352/1 "2011-01-18T00:46:30Z")

</div>

I’m trying to display an xml file (news.xml) in a text field (with an instance name of newsTxt). The data displays exactly as I want it to when I trace it, but when I try to load it into the text field, it only shows the last section of the xml file… just says “post number 3”

Here’s the xml file:

```auto
<?xml version="1.0" encoding="utf-8"?>

<news>

<post>
<date>01.07.11</date>
<content>A lot has changed for the band. For one, we are no longer Tracey Bones. Now we are called Sinister Kid. Also, the band's added a new member to its ranks -- me, Andres, on vocals, which leaves Tyler able to concetrate completely on guitar. And I brought this website with me. It's not much in terms of content, but I figured I'd get a little creative with the animation, so enjoy.</content>
</post>

<post>
<date>01.07.11</date>
<content>post number 2</content>
</post>

<post>
<date>01.07.11</date>
<content>post number 3</content>
</post>

</news>

```

…and here’s the actionscript I am using:

```auto
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest("news.xml"));

function LoadXML(e:Event):void
{
	var xml:XML = XML(xmlLoader.data);
	var newsChildren:XMLList = xml.post.children();

	for each (var newsInfo:XML in newsChildren)
	{
		newsTxt.text = newsInfo;
	}
}

```

What am I doing wrong?
