Validation of the BITS2.1 schema fails in Xerces, passes in Saxon EE. Something to do with xml.xsd. What's going on?
Posted: Wed Nov 22, 2023 1:20 pm
I'm just getting started with XML schema and am trying to understand the BITS 2.1 schema, which is a schema for books, created by the US National Library of Medicine https://jats.nlm.nih.gov/extensions/bits/2.1/xsd.html
When I tried to validate it, I got the following warning and error:
The error is raised by this declaration
On the one hand, xml:base is part of the default XML elements. On the other hand, xmlns:xml isn't included in the namespace declaration in the xsd file I downloaded. That begs the question, should it be?
In other words, why didn't NLM include xmlns:xml="..." in the above declaration?
It's also not explicitly imported. In fact, one clue as to what's going on is that in the main file of the schema, there's an import statement that's commented out.
So I'm a bit confused. Is this Xerces not recognising that the base xml namespace is implicit, or should it actually be declared and Saxon EE is passing something that shouldn't be passed? Bearing in mind, I didn't write this schema, it's an industry standard schema in broad use, so I assume it's correct. Is this a known issue with validation and the commented out portion of the import statement a workaround?
Any insights into why this discrepancy is happening would be greatly appreciated.
When I tried to validate it, I got the following warning and error:
W [oXygen] Hint: Some components referred by your schema were not found. If this schema file is included in a schema from where those components are visible then you should validate it starting from that main schema file. You can do this either by using the Main Files support (add the main schema file in the Main Files folder) or by creating a validation scenario (associated with the current file) that will validate the main schema file. Search for "Main Files Support" and/or "Validation Scenario" in the oXygen Help for more information.
Switching from Xerces to Saxon EE makes the error go away. I've gone back and forth a few times. It's a reproducible behaviour.E [Xerces] Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.
The error is raised by this declaration
Code: Select all
<xsd:complexType mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:group ref="abbrev-elements"/>
</xsd:choice>
<xsd:attribute name="alt" use="optional" type="xsd:string"/>
<xsd:attribute name="content-type" use="optional" type="xsd:string"/>
<xsd:attribute name="hreflang" use="optional" type="xsd:NMTOKEN"/>
<xsd:attribute name="id" use="optional" type="xsd:ID"/>
<xsd:attribute name="specific-use" use="optional" type="xsd:string"/>
<xsd:attribute ref="xlink:actuate" use="optional"/>
<xsd:attribute ref="xlink:href" use="optional"/>
<xsd:attribute ref="xlink:role" use="optional"/>
<xsd:attribute ref="xlink:show" use="optional"/>
<xsd:attribute ref="xlink:title" use="optional"/>
<xsd:attribute ref="xlink:type" use="optional" fixed="simple"/>
<xsd:attribute ref="xml:base" use="optional"/>
<xsd:attribute ref="xml:lang" use="optional"/>
</xsd:complexType>
Code: Select all
<xsd:schema xmlns:mtl="http://www.mulberrytech.com/taglib"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:ali="http://www.niso.org/schemas/ali/1.0/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
It's also not explicitly imported. In fact, one clue as to what's going on is that in the main file of the schema, there's an import statement that's commented out.
Code: Select all
<xsd:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="standard-modules/xlink.xsd"/>
<xsd:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="standard-modules/mathml3/mathml3.xsd"/>
<xsd:import namespace="http://www.w3.org/2001/XInclude"
schemaLocation="standard-modules/module-xi.xsd"/>
<xsd:import namespace="http://www.niso.org/schemas/ali/1.0/"
schemaLocation="standard-modules/module-ali.xsd"/>
<!-- <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="standard-modules/xml.xsd"/>-->
<xsd:include schemaLocation="BITS-book2-1-elements.xsd"/>
Any insights into why this discrepancy is happening would be greatly appreciated.