Where to put copyright information in an XSD?

主宰稳场 提交于 2020-01-03 15:40:35

问题


When placing copyright information in an XML Schema Definition (XSD), is there an official (or semi-official, universally accepted) location for doing so?

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>

回答1:


XSD itself has no specific, direct support for copyright information. Three methods are used in practice:

  1. XML-level comments:

    <!-- Copyright 2015 Example.com. All rights reserved. -->
    

    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.

  2. XSD-level documentation (as you mention):

    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        Copyright 2015 Example.com. All rights reserved.
      </xsd:documentation>
    </xsd:annotation>
    

    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.

  3. 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>
    

    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.



来源:https://stackoverflow.com/questions/31651247/where-to-put-copyright-information-in-an-xsd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!