Re: How to debug SAX?
From: Chris (nospam_at_nospam.com)
Date: 07/10/04
- Previous message: Andrew Thompson: "Re: java.security.AccessControlException:"
- In reply to: Konstantinos Agouros: "How to debug SAX?"
- Next in thread: Konstantinos Agouros: "Re: How to debug SAX?"
- Reply: Konstantinos Agouros: "Re: How to debug SAX?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 10 Jul 2004 13:40:42 -0500
> I have an application that reads XML-data from a network stream. Some-
> times I get exceptions like this one (catch prints it):
> SAXParEx: org.xml.sax.SAXParseException: Document root element is missing.
> Document root element is missing.
>
> I have a test application that just connects to the stream and prints
> the results. There the XML looks OK. Is there a way to see what the
> parser got presented and what causes the exception?
Debugging SAX is tricky. You can look at the embedded exception to get a
clue:
} catch (SAXException sax) {
Exception embed = sax.getException();
embed.printStackTrace();
}
The other thing to do is see if you can get *any* XML to parse. If you can,
then systematically remove elements from your problem XML file until it
works.
One problem that I had recently is that a problem file had some UTF-8
byte-order marks at the beginning of the file, before the first tag. This
cause a "root element missing" error.
- Previous message: Andrew Thompson: "Re: java.security.AccessControlException:"
- In reply to: Konstantinos Agouros: "How to debug SAX?"
- Next in thread: Konstantinos Agouros: "Re: How to debug SAX?"
- Reply: Konstantinos Agouros: "Re: How to debug SAX?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|