# XMLObject inside a XmlLoader utility class

**URL:** https://forum.kirupa.com/t/xmlobject-inside-a-xmlloader-utility-class/152762
**Category:** flash
**Created:** [June 27, 2005, 7:55am UTC](https://forum.kirupa.com/t/xmlobject-inside-a-xmlloader-utility-class/152762 "2005-06-27T07:55:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jadd](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jadd](https://forum.kirupa.com/u/jadd)
#### Post date: [June 27, 2005, 7:55am UTC](https://forum.kirupa.com/t/xmlobject-inside-a-xmlloader-utility-class/152762/1 "2005-06-27T07:55:13Z")

</div>

Hi everybody,  
i’m using Sephiroth XMLObject to parse Xml and it works nice (handling actions inside the Xml Onload event), but i would like to cut shorter coding writing a class calling Xml and XMLObject, it’s possible?. This is an attempt but it doesn’t work, or better, Xml file is parsed correctly but is not available, any ideas?. In attacment the zipped code too, thanks.

This is the class:

```auto

import mx.utils.Delegate;
import XMLObject;
class XMLLoader {
	private var xmlFileName:String;
	private var x:XML;
	public var xmlObject:Object;
	function XMLLoader(sxmlFileName:String) {
		xmlFileName = sxmlFileName;
		init();
	}
	private function init() {
		x = new XML();
		x.ignoreWhite = true;
		x.load(xmlFileName);
		x.onLoad = Delegate.create(this, parse);
	}
	private function parse() {
		var tempObject = new XMLObject();
		xmlObject = tempObject.parseXML(x);
	}
}

```

and this is fla action:

```auto

loadXmlMenu();
 function loadXmlMenu() {
 	myXml = new XMLLoader("test.xml");
 	myArray = myXml.xmlObject.HomeMenu.Item;
 	trace(myArray);
 }

```
