Debian Codegraph @

mkdtskel

raw
1 #!/usr/bin/perl -s
2 use XML::DT;
3 use XML::DTDParser "ParseDTDFile";
4 use File::Temp;
5
6 our ($dtd, $html, $lines);
7
8 my $filename = shift;
9
10 $dtd = 1 if $filename =~ m!\.dtd$!;
11
12
13 if ($dtd) {
14 mkdtskel_fromDTD ($filename, @ARGV);
15 }
16 else {
17 if ($lines) {
18 ## XXX - fixme, using head/xmllint is not a good idea
19 my $tmpfile = File::Temp->new( UNLINK => 0 )->filename;
20 system("head -$lines $filename | xmllint --recover - > $tmpfile");
21 $filename = $tmpfile;
22 }
23
24 if ($html) {
25 mkdtskel("-html", $filename, @ARGV);
26 }
27 else {
28 mkdtskel($filename, @ARGV);
29 }
30 unlink($filename) if $lines;
31 }
32
33 __END__
34
35 =encoding utf-8
36
37 =head1 NAME
38
39 mkdtskel - Perl code skeleton generator to process XML files with XML::DT
40
41 =head1 SYNOPSIS
42
43 mkdtskel [-lines=20000] <xmlfile>
44
45 mkdtskel -dtd <dtdfile>
46
47 mkdtskel -html <htmlfile>
48
49 =head1 DESCRIPTION
50
51 Use this command to prepare a skeleton file with basic code needed to
52 process your XML file with XML::DT; The command checks the element
53 names and for each one, the attributes. This information is described
54 on the generated file to remember the programmer.
55
56 =head1 SEE ALSO
57
58 XML::DT(1), mkdtdskel(1), mkxmltype(1) and perl(1)
59
60 =head1 AUTHORS
61
62 Jose Joao Almeida, <[email protected]>
63
64 Alberto Manuel Simões, <[email protected]>
65
66 =head1 COPYRIGHT AND LICENSE
67
68 Copyright 1999-2013 by Projecto Natura
69
70 This library is free software; you can redistribute it
71 and/or modify it under the same terms as Perl itself.
72
73 =cut
74