# Getting a list from a XML file and printing it in movieclips

**URL:** <https://forum.kirupa.com/t/getting-a-list-from-a-xml-file-and-printing-it-in-movieclips/323483>\
**Category:** flash\
**Created:** [July 3, 2011, 3:03pm UTC](https://forum.kirupa.com/t/getting-a-list-from-a-xml-file-and-printing-it-in-movieclips/323483 "2011-07-03T15:03:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubenDoliveira](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rubendoliveira/32/3905_2.png) [@RubenDoliveira](https://forum.kirupa.com/u/RubenDoliveira)\
**Post date:** [July 3, 2011, 3:03pm UTC](https://forum.kirupa.com/t/getting-a-list-from-a-xml-file-and-printing-it-in-movieclips/323483/1 "2011-07-03T15:03:46Z")

</div>

Hi everyone,

I have a XML file with the following content:

```auto

<?xml version="1.0"?>
<schedule>
	<class>
		<name>AAA</name>
		<time>9h30</time>
	</class>
	<class>
		<name>BBB</name>
		<time>10h30</time>
	</class>
</schedule>

```

I’m reading the XML file and I am able to print on a container, like this:

```auto

public function prepareXML():void{ 
    xmlLoader.addEventListener(Event.COMPLETE, readXML);
    xmlLoader.load(new URLRequest("testxml.xml"));
}
		
public function readXML(e:Event):void {
    xmlData = new XML(e.target.data);
    ParseClasses(xmlData);
}
				
function ParseClasses(e:XML):void {
    var nameList:XMLList = e.class.name.text();
    var timeList:XMLList = e.class.time.text();

    for (var i:int = 0; i < classList.length(); i++)
    {
        _container = new container;
	_container.x = 45;
	_container.x = 45 + i % 2 * 45
	_container.y = 200 + (i* 95);
	addChild(_container);
				
	var nameElement:XML = nameList*;
	var timeElement:XML = timeList*;
				
	_container.name.htmlText = nameElement*;
	_container.time.htmlText = timeElement*;
    }
}

```

Happens that it actually assumes the correct number of XML elements (2 classes), however, I can only print data on the first container (only the time and name from the first class).

Any ideas why?

Thank you in advance.
