Project

Profile

Help

Bug #3017

closed

Schema for the fn namespace

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
2016-11-02
Due date:
% Done:

100%

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

Description

At one time the schemas for analyze-string() and for json-to-xml() were in different namespaces. In consequence of their separate origins, we have a schema for analyze-string() as a "born binary" schema constructed by the class FnNamespaceSchema, and a schema for json-to-xml() as an actual XSD document json.xsd issued as source in the data folder of the JAR file.

The class FnNamespaceSchema appears to be referenced only from unit tests, not from anywhere in the product, which means that this schema is never going to be built in response to an "import schema" declaration of any kind. There is a commented-out method EnterpriseConfiguration.addSchemaForFnNamespace() that would use it if it were not commented out.

The method EnterpriseConfiguration.addSchemaForBuiltInNamespace(), when given the FN namespace URI as an argument, appears to load only the json.xsd schema.

We should probably combine the two schemas for the FN namespace into one document and issue that in the data directory. It should probably be an SCM file rather than an XSD file, for performance reasons.

Actions #1

Updated by Michael Kay over 7 years ago

Note also (and see also bug #2962) there is no method in the s9api SchemaManager that allows the schema for a "built-in" namespace to be loaded.

Perhaps there shouldn't be - it should happen automatically when the namespace is referenced. But the problem then is that things like XPathyCompiler.importSchemaNamespace() explicltly say that the method does not cause the schema to be loaded.

Actions #2

Updated by Michael Kay over 7 years ago

In fact the issued JAR file contains xpath-functions.xsd which xs:include's json.xsd and analyze-string.xsd. The class FnNamespaceSchema appears to be redundant, but does no harm.

I've trying (on the 9.8 branch) to run the JUnit tests in FnSchemaTests after changing them to use

config.addSchemaForBuiltInNamespace(NamespaceConstant.FN);

Not working. It has trouble finding the component schema documents analyze-string.xsd and json.xsd. Tried building a composite SCM for the target namespace (xpath-functions.scm) and loading that instead. This works - though the JUnit test testSchemaInvalid is currently failing.

Actions #3

Updated by Michael Kay over 7 years ago

The reason the unit test testSchemaInvalid() was not working is that the test instance is not actually invalid against the W3C-published schema, which allows mixed content for the fn:analyze-string element. See W3C bug 29976:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29976

The test was previously working because the "born binary" schema created in FnNamespaceSchema sets the outermost complex type to have variety ELEMENT_ONLY rather than MIXED, which is probably correct but disagrees with the W3C schema.

I have changed the unit test to use an instance that isn't sensitive to this problem.

Actions #4

Updated by Michael Kay over 7 years ago

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

I have committed these changes for 9.8. I think we should probably make the same changes for 9.7 (that is, remove the unused FnNamespaceSchema class, and replace the current json.xsd in the data directory with xpath-functions.scm). Before doing this I want to await the W3C decision on bug 29976.

Actions #5

Updated by Michael Kay over 7 years ago

  • Category set to XPath conformance
  • Status changed from In Progress to AwaitingInfo
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
Actions #6

Updated by Michael Kay over 7 years ago

W3C decided to leave the schema as is, that is with the type definition for analyze-string-result specifying mixed="true".

Actions #7

Updated by Michael Kay over 7 years ago

  • Status changed from AwaitingInfo to Resolved
  • Fix Committed on Branch 9.7 added

Applied the 9.8 fix to 9.7 - the fn namespace schema is now included in the data directory in SCM form, recompiled to use XSD 1.0 and to contain no embedded DMK license.

Actions #8

Updated by O'Neil Delpratt over 7 years ago

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

Bug fix applied in the Saxon 9.7.0.13 maintenance release.

Actions #9

Updated by O'Neil Delpratt about 7 years ago

  • Applies to branch deleted (9.8)
  • Fix Committed on Branch trunk added
  • Fix Committed on Branch deleted (9.8)

Please register to edit this issue

Also available in: Atom PDF