Project

Profile

Help

Bug #3928

closed

xs:import-schema with no namespace attribute reports no error if target schema document has a targetNamespace

Added by Michael Kay over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
-
Start date:
2018-10-01
Due date:
% Done:

100%

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

Description

The rules for xs:import in XSD 1.1 part 1 section 4.2.6.2 say

3 If D2 [the target document] exists, that is, clause 2.1 or clause 2.2 above were satisfied, then the appropriate case among the following must be true:
3.1 If there is a namespace [attribute], then its ·actual value· is identical to the ·actual value· of the targetNamespace [attribute] of D2.
3.2 If there is no namespace [attribute], then D2 has no targetNamespace [attribute]

xsl:import-schema effectively inherits these rules, because the semantics of xsl:import-schema are described in terms of an equivalent "synthetic schema document" using xs:import.

I believe we are not detecting condition 3.2, that is, the case where xsl:import-schema specifies no namespace attribute, and the referenced schema document has a targetNamespace. New test case import-schema-201 confirms this.

For xs:import itself, we get this right - as shown by new test case target007 in XSD test set targetNS.

Possible reason, in SchemaCompiler.processSchemaDocument(), it gets tangled up with the rules for chameleon include.

This is a spin-off of bug #3925

Actions #1

Updated by Michael Kay over 5 years ago

  • Subject changed from xs:import and xs:import-schema with no namespace attribute report no error if target schema document has a targetNamespace to xs:import-schema with no namespace attribute reports no error if target schema document has a targetNamespace
  • Description updated (diff)
Actions #2

Updated by Michael Kay over 5 years ago

The reason is the code in SchemaCompiler.processSchemaDocument()

if (expected != null && expected.length() > 0 && !expected.equals(targetNamespace))

which bypasses the check if the expected namespace is a zero-length string.

The logic for XSDImport does its own check, bypassing SchemaCompiler.processSchemaDocument().

Actions #3

Updated by Michael Kay over 5 years ago

  • Status changed from New to Resolved
  • Applies to branch 9.9 added
  • Fix Committed on Branch 9.9 added

Fixed on the 9.9 branch by removing the condition && expected.length() > 0 in SchemaCompiler.processSchemaDocument(). The rationale for this condition was something to do with chameleon schemas, but it seems xsd:include does not use this path.

I'm not retrofitting the patch to 9.8, for stability reasons. Although code that omits the namespace attribute in xsl:import-schema is non-conformant, it will currently work and we don't want to break it.

Actions #4

Updated by O'Neil Delpratt over 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.0.2 added

Bug fix applied to the Saxon 9.9.0.2 maintenance release.

Please register to edit this issue

Also available in: Atom PDF