Hey all,
Can anyone see whats wrong with either the code to grab the XML or the XML file itself? It looks well formed to me and I don't see the cause of the error:
A TypeError has occured: TypeError: Error #1088: The markup in the document following the root element must be well-formed.
var file:String = 'config.xml';
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(file);
loader.load(request);
loader.addEventListener("complete", onComplete);
loader.addEventListener("ioError", onIOError);
private function onIOError(event:Event):void
{
trace("IOERROR (maybe XML file does not exit or have an incorrect name)");
}
private function onComplete(event:Event):void
{
var loader:URLLoader = event.target as URLLoader;
if (loader != null) {
try {
var settings:XML = new XML(loader.data);
} catch (e:TypeError) {
trace("A TypeError has occured: \r\t" + e);
}
} else {
trace("Loader is not a URLLoader!");
}
}
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<setting1>1</setting1>
<showDebug>2</showDebug>
<someOtherSetting>3</someOtherSetting>
</settings>