Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
macguffin

validation of loaded xml

Recommended Posts

I'm sure I'm missing something very obvious but can an appended XMLLoader detect any XML format errors?

 

If my XML is well formed LoaderMax.getContent("XML") shows the XML.

If I deliberately spoil my XML (leave off an end tag for example) LoaderMax.getContent("XML")=null.

 

Also once the XML is corrupted the onComplete and onError which are attached to the XMLLoader aren't fired. I thought I might be able to get round it with an onRawLoad or onIOError event but these are also not fired.

 

Is your XMLLoader detecting that the XML is corrupt and ignoring it? If this is the case can this 'ignoring' be listened for?

 

Part of my loader needs to check that the XML is well formed and report any errors if it isn't. I wondered if there was a way to get an error if the XML is bad, end tags missing etc.

 

my loader queue code:

loadQueue = new LoaderMax({name:"mainLoad", onChildOpen:childOpenHandler, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
loadQueue.append(new SelfLoader(this, {name:"self"}));
loadQueue.append(new XMLLoader(loadFile, {name:"XML",onComplete:completeXMLHandler, onError:errorXMLHandler}));
loadQueue.load();

 

Cheers

Matt

Link to post
Share on other sites

MacGuffin,

 

In the case of malformed XML the onFail event will fire.

event.text will show you the error that was thrown.

 

Hope that helps.

 

-Rob

Link to post
Share on other sites

Thanks Rob I knew there would be an event in there that did this.

 

Thanks for taking the time to let me know.

 

Cheers

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×