在哪里向XSD架构添加版本? [英] Where to add a version to an XSD schema?

查看:104
本文介绍了在哪里向XSD架构添加版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理的应用程序具有符合XSD架构的XML输出.随着功能添加到应用程序中,XSD也会发生变化,我想在XSD文件中记下架构的版本.

The application I work on has XML output that conforms to an XSD schema. As features are added to the application, the XSD changes and I would like to note the version of the schema in the XSD file.

也许我遗漏了一些东西,但是我还没有找到一种内置的方式来标记架构的版本.

Perhaps I'm missing something, but I haven't found a built-in way to mark the version of the schema.

你如何做到的?

推荐答案

您可以使用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>

这篇关于在哪里向XSD架构添加版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆