Hi James,
On 2010-03-19, James Sewell <[email protected]> wrote:
> try {
> v = new org.custommonkey.xmlunit.Validator(is);
> v.useXMLSchema(true);
> if (!v.isValid()) {
> throw new ValidationError(v.toString());
> }
You may consider using the JAXP 1.3 validator instead when you do schema
validation (if your Java class library supports JAXP 1.3, that is), see
<http://xmlunit.sourceforge.net/userguide/html/ar01s04.html#JAXP%201.3%20Validation>.
Using this you have more control over your schema locations.
> I realize that because I am using an InputSource I have lost any
> location information from my XML, so I have tried using
> is.setSystemId(http://www.test.org);
system ID really is something from the DTD part of XML's heritage, you
could explicitly specify this using one of the alternative constructors
of Validator. It doesn't help, though, since the system ID is not what
the XML parser is going to use for schema locations.
If you want or must stick to the older API, the Validator's
setJAXP12SchemaSource() is what you are looking for, see
<http://xmlunit.sourceforge.net/userguide/html/ar01s04.html#XML%20Schema%20Validation>
Cheers
Stefan
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general