commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jai PP <jpgulba...@yahoo.com>
Subject Digester DTD validation
Date Sat, 19 Apr 2003 01:57:03 GMT
I am parsing the xml against the dtd using diegster
but the parse method does not throw any exception when
the xml does not match the dtd , it only displays the
error in the logfile. Do you know how to catch these
kind of dtd validation error. 

Here is the sample code
          
try
{
	XMLReader parse =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
         
parse.setFeature("http://xml.org/sax/features/validation",
true);
          Digester digester = new Digester();
         
digester.setFeature("http://xml.org/sax/features/validation",
true);
          digester.push(this);
          InputSource in = new InputSource(fin);
          en = new EntityResolverImpl();
          digester.setEntityResolver(en);
          digester.parse(in);
	System.out.println("continue");
}
catch(Exception e)
{
	System.out.println("Catch any exception");
}
181 [main] ERROR digester.Digester  - Parse Error at
line 42 column 12: The content of element type "ABC"
is incomplete, it must match "(T?,J?,CT)".
The content of element type "ADJUST" is incomplete, it
must match "(J?,J?,CT)".
continue
191 [main] E


thanks!
- Jai

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

Mime
View raw message