|
Java™ by example!
|
|
|
How do I create my own error handler with DOM?
Call the method setErrorHandler and pass in your custom class that implements org.xml.sax.ErrorHandler. Make sure you call the method setValidating(true)! The following example prints out a bunch of error messages, because the XML doesn't match the DTD. customers.dtd (!!remove the space between ? and xml):
customers.xml (!!remove the space between ? and xml):
Main.java:
outputs:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|