An infrequent XMLException

Hello,
I’m trying to chase down an infrequent XMLException. This is it:

[quote]An exception of class XMLException was not handled. The application must shut down.
Exception Message: msg: XML parse error 3: no element found. Exception Error Number: 2[/quote]
This happens about once every two weeks on an app that reaches out to a database, gets records in XML format, and then tries to parse the data and put it into a MySQL database. I think it’s rather obvious what is happening. It’s expecting an xml data element and there isn’t any. It’s probably because there is a malformed record that I’ll never be able to do anything about. I just want to handle the error, log it, and keep running. Don’t want to shut down the app.

I’ve handled other xml exception issues but this one is puzzling. It leaves no trace of which record it might be. I can’t figure out where in my code it’s originating.

Is there a clue in the Exception Message that someone might recognize? I’m throwing so many try/catch statements in the code that it’s confusing. I’m also not that good with XML.

Thanks for any suggestions.

why not catch the exception and dump the entire xml into a log so you can examine it ?

without seeing the XML its hard to guess at what might be wrong
it could be malformed structurally
it could have invalid xml characters in it or ones that terminate a node prematurely

but without having the xml and being able to run it through any one of several XML validation apps its hard to know

I don’t doubt that the XML for the infrequent record causing this is malformed one way or another. I can’t control user input in anyway. I get records with telephone fields that have “stories” in them. But you’re right…without having the XML there’s not much that can be learned. There are several routines that work with XML and it’s rather befuddling to deal with.