I can check that a piece of XML validates with an XSD that I have in a
jar like this:


InputSource xmlSource = resourceAsInputSource(resourcepath);
InputSource xsdInputSource = resourceAsInputSource(XsdPath);
xsdInputSource.setSystemId(xsduri);
assertNotNull(xsdInputSource);
Validator validator = new Validator(xmlSource);
validator.useXMLSchema(true);
validator.setJAXP12SchemaSource(xsdInputSource);
assertXMLValid(validator);


And I can assert that two pieces of XML are similar like this:

assertNotNull(result);
assertNotNull(resourcelocation);
log.debug(String.format("AssertStringXMLLikeResourceXML(%s)",resourcelocation));
saveResultCopy(result, resourcelocation);
InputStream resourceAsStream = this.getClass().getClassLoader()
                                .getResourceAsStream(resourcelocation);
assertNotNull(resourceAsStream);
String readerToString = FileIO.readerToString(new BufferedReader(
new InputStreamReader(resourceAsStream,"utf-8")));
log.debug(String.format("expected XML - %s",readerToString));           
                assertXMLEqual(readerToString,result);



But how can I compare two XML strings that are conformant to an XSD in a jar?

I need to do this as the XSD use xs:all and minOccurs=0 in the
xs:element to indicate that some elements are optional and can appear
in any order. The XMLs I wish to compare do have the elements in a
different order, but need to be considered the same and the test
should pass.

Thanks in advance for your help,
Regards,

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to