XSD 中的版权信息放在哪里?
Where to put copyright information in an XSD?
在 XML 架构定义 (XSD) 中放置版权信息时,是否有官方(或半官方,普遍接受的)位置?
基于 Where to add a version to an XSD schema?,xs:schema
元素中有一个官方的 version
属性 - 是否有类似的版权信息?
我看到有人使用 annotation/documentation 元素(例如 here)来做这样的事情 - 这是公认的做法吗?
<xsd:annotation>
<xsd:documentation xml:lang="en">
Copyright 2015 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
XSD本身对版权信息没有具体、直接的支持。实践中使用了三种方法:
XML级评论:
<!-- Copyright 2015 Example.com. All rights reserved. -->
这没问题,但可能 运行 违反了更愿意查看所有文档的政策
在适当的 XSD 注释中。另外,一定不要在任何上面添加这样的行
XML 声明 (<?xml version="1.0" encoding="utf-8" ?>
) 存在于
XSD 以便保持 XSD well-formed.
XSD 级文档(如您所述):
<xsd:annotation>
<xsd:documentation xml:lang="en">
Copyright 2015 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
这改进了 XML 级评论,但在
语义标记:适合人类读者,但不适合 automated/application
处理中。
XSD 级应用信息标记:
<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 级别的文档。
这些都行得通,但在开始针对此类元数据采取任何新方法之前,首先要遵循您组织中任何已制定的政策或惯例。
我完全同意 kjhuges 的回答,但我要补充一点,有一个组织试图标准化 xsd 中的元数据。
看看这个 link:https://dublincore.org/
他们为 appinfo 标签定义了几个元数据标签——这里是一个例子:
<xsd:annotation>
<xsd:appinfo xmlns:dcterms="http://purl.org/dc/terms/">
<dcterms:title>Your title here</dcterms:title>
<dcterms:description>This schema is ....</dcterms:description>
<dcterms:creator>ONTEC AG</dcterms:creator>
<dcterms:type>text/xml</dcterms:type>
<dcterms:subject>Sports, Tennis</dcterms:subject>
<dcterms:language>en</dcterms:language>
<dcterms:publisher>Your Company</dcterms:publisher>
<dcterms:rights>Unclassified</dcterms:rights>
<dcterms:rightsHolder>Your Company</dcterms:rightsHolder>
<dcterms:copyright>Copyright 2015 Example.com. All rights reserved.</dcterms:copyright>
<dcterms:status>Final</dcterms:status>
<dcterms:created>2020-06-27</dcterms:created>
<dcterms:modified>2021-02-23</dcterms:modified>
</xsd:appinfo>
</xsd:annotation>
要了解所有可用标签的概览,请查看此 link:
https://www.dublincore.org/specifications/dublin-core/dcmi-terms/
在 XML 架构定义 (XSD) 中放置版权信息时,是否有官方(或半官方,普遍接受的)位置?
基于 Where to add a version to an XSD schema?,xs:schema
元素中有一个官方的 version
属性 - 是否有类似的版权信息?
我看到有人使用 annotation/documentation 元素(例如 here)来做这样的事情 - 这是公认的做法吗?
<xsd:annotation>
<xsd:documentation xml:lang="en">
Copyright 2015 Example.com. All rights reserved.
</xsd:documentation>
</xsd:annotation>
XSD本身对版权信息没有具体、直接的支持。实践中使用了三种方法:
XML级评论:
<!-- Copyright 2015 Example.com. All rights reserved. -->
这没问题,但可能 运行 违反了更愿意查看所有文档的政策 在适当的 XSD 注释中。另外,一定不要在任何上面添加这样的行 XML 声明 (
<?xml version="1.0" encoding="utf-8" ?>
) 存在于 XSD 以便保持 XSD well-formed.XSD 级文档(如您所述):
<xsd:annotation> <xsd:documentation xml:lang="en"> Copyright 2015 Example.com. All rights reserved. </xsd:documentation> </xsd:annotation>
这改进了 XML 级评论,但在 语义标记:适合人类读者,但不适合 automated/application 处理中。
XSD 级应用信息标记:
<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 级别的文档。
这些都行得通,但在开始针对此类元数据采取任何新方法之前,首先要遵循您组织中任何已制定的政策或惯例。
我完全同意 kjhuges 的回答,但我要补充一点,有一个组织试图标准化 xsd 中的元数据。 看看这个 link:https://dublincore.org/
他们为 appinfo 标签定义了几个元数据标签——这里是一个例子:
<xsd:annotation>
<xsd:appinfo xmlns:dcterms="http://purl.org/dc/terms/">
<dcterms:title>Your title here</dcterms:title>
<dcterms:description>This schema is ....</dcterms:description>
<dcterms:creator>ONTEC AG</dcterms:creator>
<dcterms:type>text/xml</dcterms:type>
<dcterms:subject>Sports, Tennis</dcterms:subject>
<dcterms:language>en</dcterms:language>
<dcterms:publisher>Your Company</dcterms:publisher>
<dcterms:rights>Unclassified</dcterms:rights>
<dcterms:rightsHolder>Your Company</dcterms:rightsHolder>
<dcterms:copyright>Copyright 2015 Example.com. All rights reserved.</dcterms:copyright>
<dcterms:status>Final</dcterms:status>
<dcterms:created>2020-06-27</dcterms:created>
<dcterms:modified>2021-02-23</dcterms:modified>
</xsd:appinfo>
</xsd:annotation>
要了解所有可用标签的概览,请查看此 link: https://www.dublincore.org/specifications/dublin-core/dcmi-terms/