# Displaying XML in textField

**URL:** <https://forum.kirupa.com/t/displaying-xml-in-textfield/240948>\
**Category:** Uncategorized\
**Created:** [October 8, 2007, 6:33pm UTC](https://forum.kirupa.com/t/displaying-xml-in-textfield/240948 "2007-10-08T18:33:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GhandiJones](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@GhandiJones](https://forum.kirupa.com/u/GhandiJones)\
**Post date:** [October 8, 2007, 6:33pm UTC](https://forum.kirupa.com/t/displaying-xml-in-textfield/240948/1 "2007-10-08T18:33:08Z")

</div>

Ok… I’ve been stumped over this for a little while, and just can’t get it. I have done the Using XML in Flash CS3/AS3 tutorial, and have been unsuccessful at achieving all nodes of my xml to display in a textfield. My trace shows everything correctly, however, on the stage I only get one line. This is the code…

import flash.display._;  
import flash.text._;

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

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);  
xmlLoader.load(new URLRequest("…/xml/news.xml"));

var myTF:TextField = new TextField();  
myTF.multiline = true;  
myTF.autoSize = “left”;  
myTF.border = true;  
myTF.textColor = 0xFFFFFF;  
myTF.wordWrap = true;

addChild(myTF);

function LoadXML(e:Event):void {  
xmlData = new XML(e.target.data);  
ParseNews(xmlData);  
}

function ParseNews(NewsInput:XML):void {

```
var newsChildren:XMLList = NewsInput.Article.children();

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

```

}

And this is the XML…

\<?xml version=“1.0” encoding=“utf-8”?\>

\<News\>  
\<Article\>  
\<Headline\>News Article 1\</Headline\>  
\<Date\>XX.XX.XX\</Date\>  
\<Content\>Whatever you want\</Content\>  
\</Article\>  
\<Article\>  
\<Headline\>News Article 2\</Headline\>  
\<Date\>XX.XX.XX\</Date\>  
\<Content\>Whatever you want\</Content\>  
\</Article\>  
\</News\>

If you guys have got any ideas… I just can not figure out what I am doing wrong. I’m trying, but I just can’t get it. Thanks.
