Project

Profile

Help

Bug #2962

closed

Lax validation doesn't use the XML namespace schema

Added by Michael Kay about 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema-Aware processing
Sprint/Milestone:
-
Start date:
2016-09-26
Due date:
% Done:

100%

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

Description

When lax validation is initiated, typically from XSLT or XQuery code, the schema for the XML namespace is used only if it has been explicitly imported. This means that xml:id attributes will not be validated as unique unless the XML namespace is imported. Since Saxon has built-in knowledge of the XML namespace it should probably be implicitly imported.

Actions #1

Updated by Michael Kay about 8 years ago

  • Status changed from New to Resolved
  • Applies to branch 9.7, 9.8 added
  • Fix Committed on Branch 9.7, 9.8 added

Added a call to addSchemaForXmlNamespace() to the initializer for EnterpriseConfiguration.

Tested by a QT3 test for fn:idref() generated from the examples in the F+O spec.

Actions #2

Updated by O'Neil Delpratt about 8 years ago

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

Bug fix applied in the Saxon 9.7.0.10 maintenance release

Actions #3

Updated by Michael Kay about 8 years ago

  • Status changed from Closed to In Progress

Unfortunately the fix for this issue (included in 9.7.0.10) has a nasty side-effect - creating an EnterpriseConfiguration fails if there is no license file on the classpath. This prevents other methods of supplying a license file working, and prevents fallback to unlicensed mode.

Actions #4

Updated by Michael Kay about 8 years ago

Another side-effect has been reported: SCM files that include declarations of attributes in the XML namespace will no longer load, because they are treated as duplicates.

Actions #5

Updated by Michael Kay about 8 years ago

If I remove the code that adds the XML-namespace schema, the following QT3 tests fail

-s:app-spec-examples -t:fo-test-fn-idref-001
Validation error 
  XQDY0027: There is one IDREF value with no corresponding ID:
    ID21256
  See http://www.w3.org/TR/xmlschema11-1/#cvc-id clause 1
in TestSet app-spec-examples
There is one IDREF value with no corresponding ID:
    ID21256
Assertion assert-deep-eq ("Brown")  failed
Expected success, got error
*** TEST-FAILURE: result err:XQDY0027 Expected success.
-s:app-spec-examples -t:fo-test-fn-idref-002
Validation error 
  XQDY0027: There is one IDREF value with no corresponding ID:
    ID21256
  See http://www.w3.org/TR/xmlschema11-1/#cvc-id clause 1
in TestSet app-spec-examples
There is one IDREF value with no corresponding ID:
    ID21256
Assertion assert-deep-eq ("Singh")  failed
Expected success, got error
Actions #6

Updated by Michael Kay about 8 years ago

See also W3C bug 29975.

I think these two test cases make the assumption that the schema for the XML namespace is implicitly imported, and there is nothing in the spec to justify this assumption. We should change the test cases to explicitly import this namespace (not trivial since they are auto-generated from examples in the spec.)

Actions #7

Updated by O'Neil Delpratt about 8 years ago

  • Fixed in Maintenance Release deleted (9.7.0.10)
Actions #8

Updated by Michael Kay about 8 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on Branch deleted (9.7)

I have changed config.getElementDecl() and config.getAttributeDecl() on the 9.8 branch so that when (a) the requested declaration does not exist, and (b) the target namespace is one of those for which a built-in schema is available (XML, FN, XSI), then the built-in schema is instantiated and the request is repeated. The effect of this is that lax validation of elements and attributes with names such as xml:space or fn:analyze-string-result now performs validation rather than causing it to be skipped.

Having been bitten by the side-effects of the previous attempt at solving this, I'm going to make this solution apply to 9.8 only.

Actions #9

Updated by O'Neil Delpratt almost 8 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 9.7.0.15 added

Bug fix applied to the Saxon 9.7.0.15 maintenance release

Actions #10

Updated by O'Neil Delpratt over 7 years ago

  • Fix Committed on Branch trunk added
  • Fix Committed on Branch deleted (9.8)
Actions #11

Updated by O'Neil Delpratt over 7 years ago

  • Applies to branch deleted (9.8)

Please register to edit this issue

Also available in: Atom PDF