CTAN Comprehensive TeX Archive Network

Querying the CTAN Database with XML – List of Licenses

The list of licenses can be obtained under the URL

http://www.ctan.org/xml/2.0/licenses

The result is an XML file as in the following listing:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE licenses SYSTEM 'http://www.ctan.org/xml/2.0/catalogue.dtd'>
<licenses>
  <license key="apache2" name="Apache License, version 2.0" free="true"/>
  <license key="artistic" name="Perl Artistic License" free="false"/>
  <license key="artistic2" name="Perl Artistic License, version 2" free="true"/>
  <license key="bsd" name="BSD Style License" free="true"/>
  <license key="bsd2" name="FreeBSD License" free="true"/>
  <license key="bsd3" name="Simplified BSD License" free="true"/>
  <license key="bsd4" name="BSD License" free="true"/>
  <license key="fdl" name="Free Documentation License" free="true"/>
  <license key="gfl" name="The GUST Font License (GFL)" free="true"/>
  <license key="gfsl" name="The GUST Font Source License (GFSL)" free="true"/>
  <license key="gpl" name="GNU General Public License" free="true"/>
  <license key="gpl2" name="GNU General Public License, version 2" free="true"/>
  <license key="gpl3" name="GNU General Public License, version 3" free="true"/>
  …
</licenses>  

The list has the outer tag <licenses>. The licenses contained in this list are ordered ascending on the key of the license.

<license>

Each license is contained within the tag <license>. This tag has several attributes:

key
This attribute contains the key of the license. This attribute is mandatory.
name
This attribute contains the printable name of the license.
free
This attribute contains the indication whether the license is considered free. It can take the values true or false.

Selecting

The list can be restricted to contain part of the licenses only. The condition is that the key starts with a given string. This string is specified with the parameter key.

http://www.ctan.org/xml/2.0/licenses?key=gpl

The following example extracts all licenses for which the key starts with the letter n:

http://www.ctan.org/xml/2.0/licenses?key=n

Omitting Or Enforcing the Doctype Declaration

The list of licenses may include a doctype declaration. This declaration can be suppressed with the URL parameter no-dtd which should be set to true as in

http://www.ctan.org/xml/2.0/licenses?no-dtd=true

A doctype declaration can be enforced with the URL parameter no-dtd which should be set to false in this case.

The default is no-dtd=false.

Omitting the XML Declaration

The list of licenses starts with an XML declaration. This declaration can be suppressed with the URL parameter no-xml which should be set to true as in

http://www.ctan.org/xml/2.0/licenses?no-xml=true
Guest Book Sitemap Contact Contact Author