Details
Description
The current approach to implement the xml schema validation with the Woodstox/
W3CMultiSchemaFactory is unable to validate many schema and returns false-positive results for them.
The validator is attached on an (NUllOutputStream-) XMLStreamWriter (see org/apache/cxf/databinding/source/XMLStreamDataReader.java:231) but this can't work for abstract elements which needs to be declared explicit thru xsi:type attribute.
For example the following element:
<AbstractElement xsi:type="test:STE_ReproducerBasis">Valid1</AbstractElement>
can't be validate thru this approach because at time of the "StartElement" validation of the AbstractElement tag (see com.ctc.wstx.msv.GenericMsvValidator#validateElementStart) the xsi:type attribute is not known to the current attribute-context and therefore it's not possible to create the right "ChildAcceptor".
It returns with an (false-positive) validation error.
I've attached an reproducer which shows an example and that the validation fails only because it was attached on an writer.
The same xml could be successfully validated if the validator was attached to the reader instance.
I don't understand the decision why the validator was attached on the writer and not the reader.
Perhaps someone could give some more details about this and then i could try to solve this bug by myself (pull-request).
Another point: it looks like there is no way to choose between MSV and the fallback (schema.newValidator().validate(..)) implementation.
This leaves me in a problematic situation, i can't explicit switch to the fallback (which will work). Perhaps this should be allowed in the fix of this issue too.
reproducer.tgz