且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在哪里向XSD架构添加版本?

更新时间:2023-09-27 16:49:22

您可以使用xsd文档的命名空间

You can use the namespace of your xsd document

<xs:schema targetNamespace="http://yourcompany/yourapp/1.0" ... >
  ...
</xs:schema>

以w3.org定义的xsd为例,这就是他们的方法.请注意,根据定义,此处的更改通常对于xsd的所有使用者来说都是一个重大更改(无论实际更改有多小,或更改了版本号的哪一部分).

As an example look at the xsd's defined by w3.org, this is how they do it. Do note that changing the version number here would usually by definition be a breaking change for any consumers of your xsd (no matter how small the actual change was, or which part of the version number you changed).

对于影响较小的版本控制,似乎在根元素上放置了版本属性已达成协议:

For less impacting versioning, there seems to be an agreement about putting a version attribute at your root element:

<xs:schema version="1.0.0" ...>
  ...
</xs:schema>