Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] DTD Validation with SAXBuilder()

Jing Chen

2004-06-17

Replies:

DTD Validation with SAXBuilder()

Hi,

I am trying to validate the XML with DTD with the following code. I wrote an invalidate xml for testing, but the code did not catch it (where MyErrorHandler extends BuilderErrorHandler). Can you tell what went wrong? Thanks!!

SAXBuilder builder = new SAXBuilder (true);
builder.setValidation(true);
MyErrorHandler handler = new MyErrorHandler();
builder.setErrorHandler(handler);
reportsParamDoc = new SAXBuilder().build(file);
if (!handler.isValid)
System.exit(-1);

©2008 junlu.com - Jax Systems, LLC, U.S.A.