在XSD中将版权信息放在哪里? [英] Where to put copyright information in an XSD?
问题描述
在将版权信息放入XML架构定义(XSD)中时,是否有官方的(或半官方的,普遍接受的)位置?
When placing copyright information in an XML Schema Definition (XSD), is there an official (or semi-official, universally accepted) location for doing so?
基于向XSD架构添加版本的位置?,在xs:schema
元素中有一个官方的version
属性-版权信息是否类似?
Based on Where to add a version to an XSD schema?, there's an official version
attribute in the xs:schema
element - is there something similar for copyright information?
我见过人们在使用注释/文档元素(例如此处)来表示类似的内容-这是公认的方法吗?
I have seen people using annotation/documentation elements (e.g. here) for something like this - is this the accepted way of doing this?
<xsd:annotation>
<xsd:documentation xml:lang="en">
Copyright 2015 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
推荐答案
XSD本身对版权信息没有特定的直接支持.在实践中使用了三种方法:
XSD itself has no specific, direct support for copyright information. Three methods are used in practice:
-
XML级注释:
XML-level comments:
<!-- Copyright 2015 Example.com. All rights reserved. -->
可以,但是可能会违反一些政策,希望查看所有文档
在正确的XSD注释中.另外,请确保不要在任何行上方添加这样的行
XML声明(<?xml version="1.0" encoding="utf-8" ?>
)存在于
XSD,以保持XSD 格式正确.
This is ok but may run afoul of policies preferring to see all documentation
in proper XSD annotations. Also, be sure not to add such a line above any
XML declaration (<?xml version="1.0" encoding="utf-8" ?>
) present in the
XSD so as to keep the XSD well-formed.
XSD级别的文档(如您所述):
XSD-level documentation (as you mention):
<xsd:annotation>
<xsd:documentation xml:lang="en">
Copyright 2015 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
这对XML级别的注释进行了改进,但是在以下方面仍然缺乏 语义标记:对人类读者来说很好,但对于自动化/应用程序则不理想 处理.
This improves upon XML-level comments but is still lacking in the area of semantic markup: Fine for human readers but non-ideal for automated/application processing.
XSD级别的appinfo标记:
XSD-level appinfo markup:
<xsd:annotation>
<xsd:appinfo>
<copyright-notice>
Copyright 2015 Example.com. All rights reserved.
<copyright-notice>
<license uri="http://www.apache.org/licenses/LICENSE-2.0"
version="2.0">Apache License, Version 2.0</license>
<author>J Smith</author>
<!-- ... -->
</xsd:appinfo>
</xsd:annotation>
这在通用XSD级别的文档上有进一步的改进.
This improves further upon generic XSD-level documentation.
所有这些工作都是有效的,但首先要遵循组织中任何已建立的策略或惯例的领导,然后再针对这种元数据采用任何新方法.
These all work but follow first the lead of any established policies or conventions at your organization before embarking on any new approach for this sort of metadata.
这篇关于在XSD中将版权信息放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!