XSD“版本"属性语义 [英] XSD "version" attribute semantics
问题描述
<schema xmlns="http://www.w3.org/2001/XMLSchema" ... version="xxx">
XSD规范 https://www.w3.org/TR/xmlschema11-1/#declare-schema 没有为version
属性指定语义:
The XSD specification https://www.w3.org/TR/xmlschema11-1/#declare-schema does not specify the semantics for the version
attribute:
其他属性(
id
和version
)是为了方便用户使用,本规范未为其定义任何语义.
The other attributes (
id
andversion
) are for user convenience, and this specification defines no semantics for them.
也没有W3C版本指南 https://www.w3.org/TR/xmlschema-guide2versioning/.
Nor does that the W3C versioning guide https://www.w3.org/TR/xmlschema-guide2versioning/.
是否应使用此属性来指定XML架构文档的版本(例如2.3.1
)还是用于编写架构文档的XSD语言的版本(即1.0
或1.1
)?还是语义选择仍然在设计者/开发者身上?
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?
推荐答案
xs:schema/@version
属性用于指定要开发的XSD版本,而不是XSD 1.0 vs 1.1. 语义版本或其他任何用户定义的语义都可以使用.正如您的引文中所指出的那样,完全由用户来定义.
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.
要指定XSD 1.0与1.1,XSD 1.1提供了条件包含,可以在任何XSD元素(包括xsd:schema
根元素)上使用.例如,需要断言的XSD可能表明需要XSD 1.1,如下所示:
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>
这篇关于XSD“版本"属性语义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!