Type substitution in Extensible Layer prevents DDMSence validation
Taken from this discussion thread
The DDMS Extensible Layer (pre-DDMS 5.0) allows arbitrary content at the end of a DDMS metacard. If this extensible layer uses type substitution (via xsi:type), the underlying XMLReader will fail validation, as the schema from which the type originates is not in the external schema chain. Need to investigate further to decide course of action. Likely outcomes (mutually exclusive):
1) Enforce only syntax correctness in the Extensible Layer, not external schema content.
2) Allow the XMLReader to discover referenced external schemas that allow the Extensible Layer to be fully validated when it contains type substitution.
3) Provide configuration options for one or more of the above.
DDMSReader reader = new DDMSReader(DDMSVersion.getVersionFor("2.0"));
reader.getDDMSResource(new FileReader(new File("data/test/2.0/DDMSENCE-223.xml"));
Code changes committed in r1001.
The Xerces2 J SAXParser doesn't have a way to selectively suppress this validation of the Extensible Layer while keeping schema validation intact for the larger DDMS metacard. Also investigated the "http://apache.org/xml/features/validation/schema/ignore-xsi-type-until-elemdecl" SAX Feature, but it had no effect in this case.
It is possible to open up the XMLReader and allow additional schemas to be inserted into the external schema location chain. In this way, the schema defining the extensible content can be used for full validation. This works in my small-scale tests.