Querying the CTAN Database with XML – Topic
The information about a single topic can be obtained under the URL like
The last element in the URl is the key of the topic as used by CTAN. Those keys are also listed in the list of topics.
The result is an XML file as in the following listing:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE topic SYSTEM 'http://www.ctan.org/xml/2.0/catalogue.dtd'> <topic name="cv" details="curriculum vitae/Resumé" />
The entry has the outer tag <topic>
.
This tag has several attributes:
name
- This attribute contains the key of the topic. This attribute is mandatory.
details
- This attribute contains a short description of the topic.
References
You can request that more information about the topics is provided.
This information is the list of packages in which the topic is mentioned.
This is accomplished with the parameter ref
. It can be set to
true
as in the following example:
This results in an XML file like in the following listing;
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE authors SYSTEM 'http://www.ctan.org/xml/2.0/catalogue.dtd'> <topic name="cv" details="curriculum vitae/Resumé"> <package key="currvita" /> <package key="cvsty" /> <package key="cv" /> <package key="curve" /> … </topic
In this case the <topic>
tag contains a list of inner
tags for the packages. Each package is contained in the tag
<package>
which has the following attributes:
key
- This attribute contains the key of the package. This attribute is mandatory.
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
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