Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What tags do I use for adding copyright notices to xml files?

I am developing an app for my customer. The content that we create in the strings.xml are proprietary to them and they want a copyright notice and their trademark notice inside the XML file.

I want to be able to list both my copyright, and my customer's copyright.
What is the practice for including such information into the xml? Do I create a tag called "copyright"?

like image 298
Angel Koh Avatar asked Dec 20 '22 21:12

Angel Koh


1 Answers

XML are not meant to be viewed by the public, but by developers or tools.

Carrying author information is either part of the data (as in blog articles having an author) or it doesn't.

You can however use XML comments for that. Or you can define your own XSD and structure everything like this:

<?xml?>
<!--
    Copyright notices here
    From you regarding the XML itself
    From your client regarding the XML contents
-->
<root xmlns:copyright="http://www.w3.org/1999/xhtml">
    <!-- per file meta-data here -->
    <metadata>
        <!-- authors make it -->
        <author name="XXXXX" />
        <!-- copyright holders buy it from authors and sell it -->
        <copyright name="XXXXX" />
        <license type="GPL">
            Lorem ipsum dolor sit amet...
        </license>
    </metadata>
    <data>
        <entry>
            <!-- per entry meta-data here -->
            <metadata>
                <author name="XXXXX" />
            </metadata>
            <contents>
            </contents>
        </entry>
    </data>
</root>

Also if it is needed by third party applications (to be extracted and shown) it would be more useful if you used XML elements not comments, as they are easy to manipulate.

I mean it's ok to have a comment with a simple text but if you want to put complex info there like I showed in my example, with sub-fields like author/copyright/license, it is easy for third party programmers to get those Node objects.

As a variation if you're feeling particularly namespacey:

<?xml?>
<!--
    Copyright notices here
    From you regarding the XML itself
    From your client regarding the XML contents
-->
<root xmlns:copyright="http://www.w3.org/1999/xhtml">
    <!-- per file meta-data here -->
    <copyright:info>
        <!-- authors make it -->
        <copyright:author name="XXXXX" />
        <!-- copyright holders buy it from authors and sell it -->
        <copyright:holder name="XXXXX" />
        <copyright:license type="GPL">
            Lorem ipsum dolor sit amet...
        </copyright:license>
    </copyright:info>
    <data>
        <entry copyright:author="author name" copyright:holder="holder name">
            <contents>
            </contents>
        </entry>
    </data>
</root>

With namespaces the third party programmers will have an easy time separating the two layers of information.

like image 104
Mihai Stancu Avatar answered Mar 18 '23 14:03

Mihai Stancu