summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/new-texcatalogue-parsing.pl
blob: c5418cf8f5d44ae0936636fd03604f242fced71a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w

use XML::XPath;
use XML::XPath::XMLParser;

my $parser = new XML::XPath->new(filename => 'achemso.xml') ||
  die "Failed to parse achemso.xml";

my $name = $parser->findvalue("/entry/name");
my $caption = $parser->findvalue("/entry/caption");
my $version = $parser->findvalue('/entry/version/@number');
my $license = $parser->findvalue('/entry/license/@type');
my $description = $parser->findvalue("/entry/description");
my $ctan = $parser->findvalue('/entry/ctan/@path');
my $texlive = $parser->findvalue('/entry/texlive/@location');
my $miktex = $parser->findvalue('/entry/miktex/@location');

my $docset = $parser->find('/entry/documentation');
my @docs;
foreach my $node ($docset->get_nodelist) {
	$det = $parser->find('./@details',$node);
	$href = $parser->find('./@href',$node);
	push @docs, [ $det, $href ];
}
print "MISSING DOCUMENTATION STUFF!!\n";

print "name=$name\n";
print "caption=$caption\n";
print "version=$version\n";
print "license=$license\n";
print "description=$description\n";
print "ctan=$ctan\n";
print "texlive=$texlive\n";
print "miktex=$miktex\n";

foreach $d (@docs) {
	my @a = @$d;
	print "doc href = ", $a[1], "\n";
	print "doc deta = ", $a[0], "\n";
}