# Parsed XML to dynamic textfield

**URL:** <https://forum.kirupa.com/t/parsed-xml-to-dynamic-textfield/282913>\
**Category:** flash\
**Created:** [February 27, 2009, 5:51pm UTC](https://forum.kirupa.com/t/parsed-xml-to-dynamic-textfield/282913 "2009-02-27T17:51:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpearson311](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jpearson311](https://forum.kirupa.com/u/jpearson311)\
**Post date:** [February 27, 2009, 5:51pm UTC](https://forum.kirupa.com/t/parsed-xml-to-dynamic-textfield/282913/1 "2009-02-27T17:51:28Z")

</div>

Hi all. I’m importing an XML file with 3 elements into Flash CS3 (AS 3.0) and when I trace the results, I get everything in the XML file parsed nicely and cleanly. Now, I have a dynamic textfield that I set equal to the parsed results, instead of a trace, but when I do it, the textfield only outputs 1 node. I have the textfield set to multiline and it still only returns 1 node. Here is my xml file:

```auto

<?xml version="1.0" encoding="utf-8"?>
<news>
    <heading date="02.15.09" title=" - NEW SITE">
        <copy>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas euismod dui eget massa. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</copy>
    </heading>
    <heading date="02.06.09" title=" - SITE AMET">
        <copy>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas euismod dui eget massa. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</copy>
    </heading>
    <heading date="01.21.09" title=" - MAECENAS">
        <copy>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas euismod dui eget massa. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</copy>
    </heading>
</news>

```

And here is my ActionScript:

```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 {
    xmlData = new XML(e.target.data);
    parseNews(xmlData);
}

function parseNews(news:XML):void {
    var newsHeadings:XMLList = news.heading;

    for each(var headline:XML in newsHeadings)
    {
        news_txt.text = headline.attribute("date") + headline.attribute("title") + "
" + headline.copy.text() + "
";
        
    }
}

```

I’d appreciate anything you can offer. Thanks so much.

Jesse
