-
error checking XML file??
I've got an XML file that I've loaded into Flash using the code:
objXML = new XML();
objXML.ignoreWhite = true;
objXML.onLoad = parseXMLData;
objXML.load("data.xml");
The parseXMLData code:
function parseXMLData(success) {
if (success) {
//goes through each node and builds an array of objects for use
}
}
Everything works fine when the XML is as it is suppose to be (well formed).
How do I check if the XML file is well formed before I use it? I want to trap bad files from coming in so that I can show an error message detailing what's wrong with the XML file.
Please help.
Thanks.
-
Senior Member
How bad is bad? valid XML but not what you are expecting or are you talking about when someone saves a picture and names it .xml. Flash will handle the latter, you will have to code for the former.
Thanks
Luke
-
Bad meaning missing brackets in the tags, missing end tags, etc. How do I code to check this?
Thanks!
-
Senior Member
Typically flash won't parse the code, success variable in your parseXMLData function will be false.
Flash is lenient with some things in XML that I know Java parsers will stop on (multiple root tags being one of them that flash accepts), but will stop for really badly formed xml.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|