“Error #1088” despite a well-formed XML file

The 1 line of code below in my XML processor class caused this error: “Error #1088: The markup in the document following the root element must be well-formed,” despite the fact that my source xml file passed multiple validation tests from multiple sources.

fEvent = XML(xmlData.fevnt);		

As soon as I got rid of the casting operation XML (…) and changed the fEvent datatype to String or Array ( a cheap trick to access XML element attributes), the error went away.

When I googled “Error #1088” most posts were about XML that was dynamically generated via a server-side script. In this instance, this was a static, well-formed XML file that suddenly started throwing this error, so I had to go through the code, commenting it out line by line to find the culprit. Who knew — google doesn’t have the answers to everything all the time! =)

Some context for the problem code, as it existed in the XML processor class:

//...

private function loadData(xmlFilePath:String):void {
			loader = new URLLoader();
			reqst=new URLRequest(xmlFilePath);
			loader.load(reqst);
			loader.addEventListener(Event.COMPLETE, onLdrComplete);
}

private function onLdrComplete(e:Event):void {
			var ldr:URLLoader=e.target as URLLoader;
			xmlData=new XML(ldr.data); //defined as xmlData:XML above
			//...
            finalEvent = XML(xmlData.finalevnt);				
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s