Hi all,

David Carver's feature request for a way to validate schema
definitions rather than instances of these schemas made me look at the
"new" validation API of JAXP 1.3 (that's Java5 and newer).

XMLUnit now has a new Validator class in the jaxp13 sub-package that
is not directly tied into the JUnit3 support classes.  Schema
definitions and instance documents must be given as
javax.xml.transformation.Source, but it is trivial to find an
implementation of that interface for streams, documents or even SAX
handlers.

One side effect is that the validation package in theory supports
validation against schema languages other than W3C XML Schema.  The
Javadocs talk about RELAX NG and Schematron, but the implementation
shipping with the JDK only supports W3C XMl Schema.

I set down and tried to get RELAX NG working during my lunch break
today (read: limited time ;-) and managed to make it work using this
blog
<http://weblogs.java.net/blog/kohsuke/archive/2006/02/validate_xml_us.html>
by Kohsuke Kawaguchi.  It works for me using his bridge code, msv and
Java5 - it does not work for Java6, see the last comment on his blog
post.

It also seems that only the XML representation of RELAX NG grammars is
supported since trying a compact definition schema failed with an
error indicating it expected a valid XML document as schema.

svn trunk contains some disabled unit tests for RELAX NG validation if
you want to play yourself.

Stefan

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to