Project

Profile

Help

Bug #1505

closed

XSD 1.1 IllegalArgumentException - reference to imported element inside override

Added by Priscilla Walmsley over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
-
Start date:
2012-04-29
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

prod.xsd (463 Bytes) prod.xsd Overridden schema document Priscilla Walmsley, 2012-04-29 20:39
temp.xsd (277 Bytes) temp.xsd Imported schema document Priscilla Walmsley, 2012-04-29 20:39
newsch3.xsd (981 Bytes) newsch3.xsd Main schema document Priscilla Walmsley, 2012-04-29 20:39
EX83a_1.xml (381 Bytes) EX83a_1.xml Instance Priscilla Walmsley, 2012-04-29 20:39
Actions #1

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.

Actions #2

Updated by Michael Kay over 12 years ago

  • Status changed from New to In Progress
  • Assignee set to Michael Kay
Actions #3

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

Actions #4

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

Also available in: Atom PDF