Hi Olav,
You can implement your own ErrorHandler (a SAX interface) and set it on the
SAXReader like so:
SAXReader reader = new SAXReader(false);
reader.setErrorHandler(new MyErrorHandler());
Your MyErrorHandler class could then call your own error logging code (or do
nothing):
class MyErrorHandler implements org.xml.sax.ErrorHandler {
public void warning(SAXParseException parm1) throws
org.xml.sax.SAXException {
System.out.println("SAX warning: " + parm1 + "\n"
+ " At column " + parm1.getColumnNumber() + ", line " +
parm1.getLineNumber());
}
public void error(SAXParseException parm1) throws
org.xml.sax.SAXException {
System.out.println("SAX error: " + parm1 + "\n"
+ " At column " + parm1.getColumnNumber() + ", line " +
parm1.getLineNumber()
+ " Message " + parm1.getMessage());
}
public void fatalError(SAXParseException parm1) throws
org.xml.sax.SAXException {
System.out.println("SAX fatal error: " + parm1 + "\n"
+ " At column " + parm1.getColumnNumber() + ", line " +
parm1.getLineNumber()
+ " ElementID " + parm1.getPublicId() + ", SystemID " +
parm1.getSystemId());
}
}
Cheers,
-- Steen
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 08, 2002 2:38 PM
> To: [EMAIL PROTECTED]
> Subject: [dom4j-user] Very basic question (I suppose)
>
>
> Hi,
>
> I am trying to parse an xml file in my application, where the DOCTYPE
> declaration points to a DTD which does not exist. The
> SAXReader therefor throws
> Exceptions at me, being annoyed by this. How can I prevent
> this and let the
> SAXReader parse the document without checking for the
> existence of the DTD file?
>
> Thanks,
> Olav
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user