XSD "version" attribute semantics
Asked Answered
M

1

4
<schema xmlns="http://www.w3.org/2001/XMLSchema" ... version="xxx">

The XSD specification https://www.w3.org/TR/xmlschema11-1/#declare-schema does not specify the semantics for the version attribute:

The other attributes (id and version) are for user convenience, and this specification defines no semantics for them.

Nor does that the W3C versioning guide https://www.w3.org/TR/xmlschema-guide2versioning/.

Is there a consensus arising whether this attribute should be used for specifying the version of the XML Schema document (e.g. 2.3.1), or for the version of the XSD language used to write the schema document (i.e. either 1.0 or 1.1)? Or is the semantics choice still on the designers/developers?

Metallurgy answered 27/5, 2017 at 8:21 Comment(0)
W
6

The xs:schema/@version attribute is used for specifying the version of the XSD being developed, not XSD 1.0 vs 1.1. Semantic versioning or any other user-defined semantics may be used. As your apropo quote indicates, it is up to the user to define.

To specify XSD 1.0 vs 1.1, XSD 1.1 provides conditional inclusion, which can be used on any XSD element, including the xsd:schema root element. For example, an XSD that requires assertions could indicate the need for XSD 1.1 like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           vc:minVersion="1.1">
  <!-- -->
</xs:schema>
Wellfed answered 27/5, 2017 at 13:49 Comment(2)
This is what I thought too, but when I was searching on the web, I found several links like this one, but none explicitly supporting my view. Which caused me to ask the question.Metallurgy
That link also supports your view. The standard to which they recommend use of xs:schema/@version refers to their IATI standard, not to the W3C XML Schema standard.Wellfed

© 2022 - 2024 — McMap. All rights reserved.