# Formatting xml in text field

**URL:** <https://forum.kirupa.com/t/formatting-xml-in-text-field/318400>\
**Category:** flash\
**Created:** [January 19, 2011, 5:32am UTC](https://forum.kirupa.com/t/formatting-xml-in-text-field/318400 "2011-01-19T05:32:57Z")\
**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 19, 2011, 5:32am UTC](https://forum.kirupa.com/t/formatting-xml-in-text-field/318400/1 "2011-01-19T05:32:57Z")

</div>

I’ve got an external xml file loaded into a text field… I’m trying to format the text within the xml file with actionscript. Specifically, I’d like to make the dates a different color from the actual posts, and I want to add a blank line between each post. 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’m 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 = newsTxt.text+"
"+newsInfo;
	}
}

```

Any help would be greatly appreciated…
