4

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>
Community
  • 1
  • 1
nwinkler
  • 52,665
  • 21
  • 154
  • 168

2 Answers2

6

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.

Community
  • 1
  • 1
kjhughes
  • 106,133
  • 27
  • 181
  • 240
0

I totally aree with kjhuges answer but I would add that there is an organization which tries to standardize the metadata in xsd's. Check out this link: https://dublincore.org/

They define several metadata tags for the appinfo tag - here an example:

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

To get an overview of all available tags check out this link: https://www.dublincore.org/specifications/dublin-core/dcmi-terms/

max
  • 1,134
  • 10
  • 16