Handling xsi:type validation inside the content extension

48 views
Skip to first unread message

Brendan Hofmann

unread,
Jun 29, 2015, 1:17:58 PM6/29/15
to ddms...@googlegroups.com
We have an issue where our users are attempting to validate some records that include an xsi:type reference to an element defined in the schema of the content extension. Saxon appears unable to resolve those types, and I think it's because the schemas used in the content extension are not being resolved. We have another validation utility that also performs schema validation, and because it is aware of the additional schemas, those xsi:type elements validate successfully. Is there any way to provide additional URI/schema mappings to DDMSence, specifically in the DDMSReader?

Caused by: buri.ddmsence.ddms.InvalidDDMSException: nu.xom.ValidityException: cvc-elt.4.2: Cannot resolve 'Facility' to a type definition for element 'definition'. at line 277, column 57
    at buri
.ddmsence.util.DDMSReader.getElement(Unknown Source)[360:catalog-transformer-ddms:4.2.6.SNAPSHOT]
    at buri
.ddmsence.util.DDMSReader.getDDMSResource(Unknown Source)[360:catalog-transformer-ddms:4.2.6.SNAPSHOT]
    at
<code that calls ddmsence>
   
... 18 more
Caused by: nu.xom.ValidityException: cvc-elt.4.2: Cannot resolve 'Facility' to a type definition for element 'definition'. at line 277, column 57
    at nu
.xom.Builder$ValidityRequired.error(Unknown Source)[360:catalog-transformer-ddms:4.2.6.SNAPSHOT]
    at org
.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
    at org
.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)[:]
    at org
.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)[:]
    at org
.apache.xerces.impl.xs.XMLSchemaValidator.getAndCheckXsiType(Unknown Source)[:]
    at org
.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)[:]
    at org
.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)[:]
    at org
.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)[:]
    at org
.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
    at org
.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
    at org
.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
    at org
.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)[:]
    at nu
.xom.Builder.build(Unknown Source)[360:catalog-transformer-ddms:4.2.6.SNAPSHOT]
    at nu
.xom.Builder.build(Unknown Source)[360:catalog-transformer-ddms:4.2.6.SNAPSHOT]
   
... 21 more
Caused by: org.xml.sax.SAXParseException: cvc-elt.4.2: Cannot resolve 'Facility' to a type definition for element 'definition'.
    at org
.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)[:]
   
... 39 more



Brian Uri!

unread,
Jun 29, 2015, 2:01:01 PM6/29/15
to ddms...@googlegroups.com, conne...@gmail.com
Good to hear from you, Brendan!

Saxon is not in the hierarchy of the base DDMSReader, as it's only used for Schematron validation. The offending class is likely the underlying XMLReader (org.apache.xerces.parsers.SAXParser, xercesImpl-2.11.0.jar). When DDMSReader is instantiated, DDMS-related 3rd-party schemas (like GML and IC) are added via the "http://apache.org/xml/properties/schema/external-schemaLocation" property to the private XMLReader instance.

A potential fix would be to increase the level of configuration allowed for the XMLReader, possibly by suppressing validation of xsi:type content or allowing additional external schemas to be added to the XMLReader.

Do you have any minimal schema and instance files I can use to explore this further?

Regards,
BU

Brendan Hofmann

unread,
Jun 29, 2015, 2:14:56 PM6/29/15
to ddms...@googlegroups.com, conne...@gmail.com
Thanks for the clarification, Brian. You're right, I did conflate Saxon and Xerces, it even says so in the stack trace.

I will construct a minimal schema/instance that demonstrates the problem for you, and get those to you as soon as possible. Thanks for responding so quickly!

Brendan Hofmann

unread,
Jun 29, 2015, 6:44:44 PM6/29/15
to ddms...@googlegroups.com, conne...@gmail.com
Brian, these two files should help demonstrate the xsi:type issue. Thanks!


On Monday, June 29, 2015 at 11:01:01 AM UTC-7, Brian Uri! wrote:
sample.xml
sample.xsd

Brian Uri!

unread,
Jun 30, 2015, 5:42:55 AM6/30/15
to ddms...@googlegroups.com, conne...@gmail.com
Thanks, I'll take a look at this over the upcoming weekend.

BU

Brian Uri!

unread,
Jul 1, 2015, 12:50:49 PM7/1/15
to ddms...@googlegroups.com, bria...@gmail.com, conne...@gmail.com
I have opened up Issue 223 to track work on this issue.

Regards,
BU

Brendan Hofmann

unread,
Jul 1, 2015, 12:52:46 PM7/1/15
to ddms...@googlegroups.com, conne...@gmail.com
Thanks Brian!

Brian Uri!

unread,
Jul 3, 2015, 12:54:53 PM7/3/15
to ddms...@googlegroups.com, conne...@gmail.com
I have a new release to fix this. I will post details in the release announcement shortly.

Brendan Hofmann

unread,
Jul 6, 2015, 10:40:27 AM7/6/15
to ddms...@googlegroups.com, conne...@gmail.com
Thanks Brian!
Reply all
Reply to author
Forward
0 new messages