CTAN Comprehensive TeX Archive Network

Querying the CTAN Database with XML – Package

The information about a single package can be obtained under the URL like

http://www.ctan.org/xml/2.0/pkg/tex

The last element in the URl is the key of the package as used by CTAN. Those keys are also listed in the list of packages.

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

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE entry SYSTEM 'http://www.ctan.org/xml/2.0/catalogue.dtd'>
<entry id='tex'>
  <name>TeX</name>
  <caption>A sophisticated typesetting engine</caption>
  <authorref id='knuth' />
  <copyright owner='D. E. Knuth' year='1982' />
  <license type='knuth'/>
  <version  number="3.1415926" />
  <description>
    TeX is a typesetting system that incorporates a macro processor.
    A TeX source document specifies or incorporates a number of macro
    definitions that instruct the TeX engine how to typeset the
    document.  The TeX engine also uses font metrics generated by
    Metafont, or by any of several other
    mechanisms that incorporate fonts from other sources into an
    environment suitable for TeX.
    
    TeX has been, and continues, a basis and an inspiration for
    several other programs, including e-TeX
    and PDFTeX.
    
    The distribution includes the source of Knuth’s
    TeX book; this source is there to read, as an
    example of writing TeX — it should not be processed
    without Knuth’s direct permission.
  </description>
  <ctan path='/systems/knuth/dist/tex' />
  <miktex location='miktex-tex-bin-2.9' />
  <texlive location='tex' />
  <keyval key='topic' value='engine' />
</entry>  

The entry has the outer tag <package> This tag has several attributes:

id
This attribute contains the unique id of the package. This attribute is mandatory.
<alias>
The entry has optional inner tags <alias> describing an alias for the package. The alias is a object which has one attribute and the body text:
id
This attribute contains the id of the alias. This attribute is mandatory.
text
The body text of the alias tag is used as its name. The name is used wherever a printed representation of the alias is required. It is mandatory.
<name>
The entry has the mandatory inner tag <name>. The name contains the print representation of the package name. This tag has no attributes.
<caption>
The entry has the mandatory inner tag <caption>. The caption contains a short description of the package. This tag has no attributes.
<authorref>
The entry can have zero or more the inner tags <authorref>. It carries the reference to an author. This tag has several attributes:
id
This attribute contains the id of the author. This attribute is mandatory.
title
This attribute is the title of the author. It is optional and can be empty. The default is empty.
givenname
This attribute contains the given name of the author. It is present only if the parameter author-name is true and the given name is known.
von
This attribute is the von part of the author's name. It is usually in lower case and has values like von, van, or de. It is optional and can be empty. The default is empty. It is present only if the parameter author-name is true and the von part is known.
familyname
This attribute contains the family name of the author. It is present only if the parameter author-name is true and the family name is known.
junior
This attribute is the junior part of the author's name. It is usually an addition to the name like jr., sr., or a numeral like I, II, III, IV. It is optional and can be empty. The default is empty. It is present only if the parameter author-name is true and the junior part is known.
pseudonym
This attribute is the alias name to protect the privacy of an author who requests it. It is optional and can be empty. The default is empty. In case this attribute is not empty the other name constituents are not shown. It is present only if the parameter author-name is true and the pseudonym is known.
female
This attribute is the boolean indicator that the author is female. It is optional and can be empty. The default is false.
died
This attribute is the indicator that the author is deceased. It is optional and can be empty. The default is empty.
<copyright>
The entry can have zero or more the inner tags <copyright>. It carries the information about the copyright. This tag has several attributes:
owner
This attribute contains the name of the copyright holder. This attribute is mandatory.
year
This attribute contains the year or years of the copyright. This attribute is mandatory.
<license>
The entry can have zero or more the inner tags <license>. It carries the information about the licenses under which several parts of the package are distributed. This tag has an attribute:
type
This attribute contains the key of the license to apply.
<version>
The entry has the inner tag <version>. It carries the information about the version of the package. This tag has several attributes:
number
This attribute contains the version number.
date
This attribute contains the version date.

At least one of number or date have to be given. Otherwise the tag is suppressed.

<description>
The entry has some optional inner tags <description>. The value is a longer description of the package. This description can make use of HTML for formatting. The tag may have an attribute:
lang
This attribute contains the ISO code for the language of the description.
<xref>
An inner tag of <description> is <xref>. It is used to reference a package. The tag may have an attribute:
refid
This attribute contains the reference.
<documentation>
The entry has some optional inner tags <documentation>. These tags indicate references to documentation. The tag may have attributes:
lang
This attribute contains the ISO code for the language of the description.
details
This attribute contains the (English) text describing this documentation item.
href
This attribute contains a reference to the documentation. The prefix ctan: indicates a reference to a directory on CTAN. If the parameter keep-url is true then this attribute contains always a valid URL without the ctan: prefix.
<ctan>
The entry has the optional inner tag <ctan>. It carries the location of the package in the CTAN tree. This tag has several attributes:
path
This attribute contains the relative path of the package in the CTAN tree. This attribute is mandatory.
file
This attribute contains the indicator that this package consists of a single file only. This is in contrast to a whole package directory. This attribute is optional and defaults to false.
<install>
The entry has the optional inner tag <install>. It carries the location of the package on CTAN in form of an installable TDS-compliant zip archive. This tag has several attributes:
path
This attribute contains path relative to the CTAN directory /install. This attribute is mandatory.
<miktex>
The entry has the optional inner tag <miktex>. It carries the name of the package in MiK. This tag has several attributes:
location
This attribute contains name of the package in MiK. This attribute is mandatory.
<texlive>
The entry has the optional inner tag <texlive>. It carries the name of the package in  Live. This tag has several attributes:
location
This attribute contains name of the package in  Live. This attribute is mandatory.
<keyval>
The entry has zero or more inner tags <keyval>. It is meant as extension point to add arbitrary key-value pairs. This tag has several attributes:
key
This attribute contains key of the key-value pair. This attribute is mandatory.
value
This attribute contains value of the key-value pair. This attribute is mandatory.

The following keys are currently in use:

topic
With this key the value contains the name of one of the topics.
index
With this key the value is also indexed for the CTAN search.

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

Expanding Author Information

The author information is contained as id referencing an entry in the authors file. If the parameter author-name can be set to true to include the first name and family name of the author as well. Example:

http://www.ctan.org/xml/2.0/pkg/tex?author-name=true

Selecting Fields

Sometimes it might be desirable to get some of the fields only. This can be accomplished with the parameter drop. It takes a comma separated list of fields to drop. Example:

http://www.ctan.org/xml/2.0/pkg/tex?drop=documentation,description

The following fields are recognized in the drop list:

aliases, announce, author, bugs, caption, copyright, ctan, description, development, documentation, home, index, install, miktex, name, repository, support, texlive, topic, version
Guest Book Sitemap Contact Contact Author