How to tell if XML file is actually XML?


#1

Hi all:

I am finishing up my copy protection code. I am using an XML keyfile. It is working OK, except if I let the user browse to a file that is called *.xml, but just contains gibberish. If this is the case, it crashes the plugin host. Hard.

Are there any recommended ways to see if the XML file I am loading and parsing is, in fact, XML? I have tried both getLastParseError() in XMLDocument, and hasTagName() in XMLElement, but they both crash.

Thanks,

Sean Costello


#2

OK, I think I solved my own problem. In addition to calling getLastParseError(), I just need to make sure that my new XmlElement is !=0.

Sean Costello