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>
XSD itself has no specific, direct support for copyright information. Three methods are used in practice:
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.
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.
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.