1DOWNLOAD-ENTITIES(1) User Contributed Perl Documentation DOWNLOAD-ENTITIES(1)
2
3
4
6 download-entities - download and parse XML Entity definitions
7
9 $ perl download-entities.pl -i # interactive
10 $ perl download-entities.pl > output-file.pm
11 $ perl download-entities.pl output-file.pm
12
13 # instead of http://www.w3.org/2003/entities/iso9573-2003/
14 $ perl download-entities.pl http://my.server.com/entities.html
15
17 This script downloads the definitions of XML entities from
18 http://www.w3.org/2003/entities/iso9573-2003/ or from whatever address
19 you give it as an argument. The argument should be an URL (that
20 LWP::UserAgent::get can access) pointing to a document with (absolute
21 or relative) references to files ending with the ".ent" suffix. These
22 files are expected to be DTD's with lines like
23
24 <!ENTITY amp "&" >
25
26 The script parses these files and prints the perl module to the
27 standard output. If you wish, you can give "file" as another argument
28 to the script and it will then print it to "file". You can also
29 specify the output file in the environment variable "OUTPUT_FILE".
30
31 The index and the output file are distinguished by the presence of
32 "://" substring. If you want to use a locally stored index file (the
33 one with the .ent references), you can access it by saying
34
35 perl download.pl file:///path/to/index.html
36
37 Note that the script currently distinguishes between relative and
38 absolute paths by looking at whether the href contains a "://"
39 substring. This can lead to crashes when the links look like
40 href="/path/file.ent".
41
42 Also, the script assumes the links have exactly the format href="..." -
43 with double quotes.
44
45 Interactive download
46 In case you run into problems downloading the documents, you can try to
47 run the script with the "-i" or "--interactive" option. This will let
48 you skip downloads or enter alternative URLs for individual documents.
49
50 The interactive mode is also triggered when the "INTERACTIVE"
51 environment variable is set to a true value (in Perl sense).
52
53 Options
54 Beside the "--interactive" option, this script also accepts the
55 "--timeout" option. It specifies the timeout for LWP::UserAgent in
56 seconds when downloading. The same is controlled by the
57 "DOWNLOAD_TIMEOUT" environment variable. The defaule (180s) timeout is
58 used when not specified.
59
60 # 10 seconds timeout - croak on failure
61 perl download-entities.pl --timeout 10 > XML/Entities/Data.pm
62 # 5 seconds timeout - croak on failure
63 DOWNLOAD_TIMEOUT=5 perl download-entities.pl > XML/Entities/Data.pm
64 # 1 second timeout - ask on failure
65 perl download-entities.pl --interactive --timeout 1 > XML/Entities/Data.pm
66
67 Dependencies
68 This script has dependencies that the "XML::Entities" module does not
69 and are therefore not mentioned in the META.yml file. These are
70 "LWP::UserAgent", "File::Basename" and "Fatal".
71
73 Copyright 2010 Jan Oldrich Kruza <sixtease@cpan.org>. All rights
74 reserved.
75
76 This library is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79
80
81perl v5.38.0 2023-07-21 DOWNLOAD-ENTITIES(1)