Bug #1505
closedXSD 1.1 IllegalArgumentException - reference to imported element inside override
100%
Description
Saxon seems to have a problem when imported components (elements, attributes) are referenced inside an override. Please see attached files.
Error message:
Error at /xs:schema/xs:complexType[1]/xs:sequence[1]/xs:element[4] in override.xsl:
Cannot reference schema components in namespace http://datypic.com/spc as it has not been imported
Error at /xs:schema/xs:complexType[1]/xs:attribute[1] in override.xsl:
Cannot reference schema components in namespace http://datypic.com/spc as it has not been imported
Warning: at xs:override on line 7 column 42 of newsch3.xsd:
The complex type ProductType is ignored, because it does not override anything in the target schema
java.lang.IllegalArgumentException: Unknown name code 1048575
at net.sf.saxon.om.NamePool.unknownNameCode(NamePool.java:693)
at net.sf.saxon.om.NamePool.getURI(NamePool.java:496)
at com.saxonica.schema.PreparedSchema.validateReference(PreparedSchema.java:981)
at com.saxonica.schema.AttributeGroupDecl.fixup(AttributeGroupDecl.java:314)
at com.saxonica.schema.UserComplexType.fixup(UserComplexType.java:868)
at com.saxonica.schema.ElementDecl.fixup(ElementDecl.java:781)
....
Files
Updated by Michael Kay over 12 years ago
- Priority changed from Low to Normal
The crash here (namecode not in namepool) is a secondary error on an error recovery path and is easily dealt with.
The primary error (Cannot reference schema components in namespace...) is much more problematic, and I think represents a problem in the W3C spec. I think that the effect of applying the override transformation given in the spec is to generate a schema document in which there is a reference to spc:giftWrap but in which the spc namespace is not imported. That is, it generates an invalid schema document. There doesn't appear to be any effective way to inject the necessary import declaration into the generated schema document. I have raised this as a specification issue: see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17574
I have made a modification to the override.xsl stylesheet that appears to fix the problem by copying xs:import declarations into the generated schema document. However, I'm not comfortable that it will work in all circumstances, especially if there are conflicts with existing import declarations. I will do some regression testing before issuing the amended version.
Updated by Michael Kay over 12 years ago
- Status changed from New to In Progress
- Assignee set to Michael Kay
Updated by Michael Kay over 12 years ago
- Status changed from In Progress to Resolved
Marking this resolved (although the spec bug against XSD 1.1 is still open).
Priscilla's test case has been added to the W3C test suite as Saxonica test Override/over039
Updated by Michael Kay over 12 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.4.0.4
Please register to edit this issue