I've been trying to improve performance of XML validation against an XSD schema, in particular with respect to XSD unique constraints, and decided to give a try to Woodstox. I pretty much follow this example, to the extent that I change the XMLValidationSchema.SCHEMA_ID_DTD
into XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA
.
The problem I experience, though, is that the Woodstox validator finds an XML valid even if the XML violates a unique constraint. Switching back in my java code to the "regular" javax.xml.validation.Schema
, javax.xml.stream.XMLStreamReader
, and javax.xml.validation.Validator
the uniqueness constraint violation is detected properly.
Also, I can confirm that the Woodstox validator does something, since, e.g., I can see it saying 'XML invalid' if, e.g., I have a negative number where a positive one is XSD-expected in the XML.
Might that be that the tools I've been using until now are fine with respect to uniqueness checks on unqualified elements, whereas Woodstox is not? It's the only idea that comes to my mind...
Also, is anyone in the position to confirm that Woodstox would perform better than Xerces based tools (pretty much everything existing in Java?) validating the unique constraints?
Any help greatly appreciated!