If you want to validate while you parse the XML,
then you've 2 main choices...
* try using a validating parser such as Xerces
using either DTD or XML Schema validation, use SAXReader(true) to enable
validation. You will probably have to create an EntityResolver to be able to
resolve the DTD or Schema documents.
* use JARV as a SAX filter so you can validate
across any schema language (my favourite, RelaxNG as well as DTD, XML Schema,
Relax or Trex). Using JARV as a SAX filter allows you to parse the document once
into SAX events and create a dom4j Document and perform the
validation.
There are sample programs demonstrating both of
these approaches in
dom4j/src/samples/validate
XercesDemo.java - shows how to validate using Xerces
JARVDemo2.java - shows how to use JARV as a SAX filter
|
Title: translation and verification best practices
- [dom4j-user] translation and verification best practices Alan Herod
- James Strachan