1XML::Catalog(3) User Contributed Perl Documentation XML::Catalog(3)
2
3
4
6 XML::Catalog - Resolve public identifiers and remap system identifiers
7
9 use XML::Catalog;
10 my $catalog=XML::Catalog->new('/xml/catalog.cat');
11 $catalog->add('http://www.w3.org/xcatalog/mastercat.xml');
12 my $sysid=$catalog->resolve_public('-//John Cowan//LOC Diacritics');
13 my $newsysid=$catalog->remap_system('http://www.w3.org');
14 $parser->setHandlers(ExternEnt=>$catalog->get_handler($parser));
15
16 Oasis Example
17 $ perl -e 'use XML::Catalog; \
18 $pubid = q|-//OASIS//DTD DocBook XML V4.5//EN|; \
19 my $catalog=XML::Catalog->new("/etc/xml/catalog"); \
20 print $catalog->resolve_public($pubid), "\n";'
21
22 file:///usr/share/sgml/docbook/xml-dtd-4.5-1.0-51.el6/docbookx.dtd
23
25 This module implements draft 0.4 of John Cowan's XML Catalog (formerly
26 known as XCatalog) proposal
27 (<http://www.ccil.org/~cowan/XML/XCatalog.html>). Catalogs may be
28 written in either SOCAT or XML syntax (see the proposal for syntax
29 details); XML::Catalog will assume SOCAT syntax if the catalog is not
30 in well-formed XML syntax.
31
32 This module, as of 1.0.0, also supports Oasis XML catalogs.
33
35 new(URL [,URL]*)
36 Read the catalog identified by URL and return a catalog object
37 implementing it. If more than one URL is given, chain the
38 additional catalogs as extensions to the catalog (they will be
39 searched before catalogs specified by EXTEND entries).
40
41 All URLs must be absolute. A URL with no protocol is treated as a
42 filename.
43
45 add(URL [,URL]*)
46 Chain the catalogs identified by the URL(s) to the current catalog.
47
48 resolve_public(PUBID)
49 Translate the public identifier PUBID to a system identifier.
50 Returns undef if the identifier could not be translated.
51
52 remap_system(SYSID)
53 Remap the system identifier SYSID as specified by the catalog.
54 Returns SYSID unchanged if no remapping was found.
55
56 get_handler(PARSER)
57 Returns a coderef to a resolver suitable for use as the ExternEnt
58 handler for an XML::Parser object. The resolver will first attempt
59 to resolve a public identifier if supplied, and then attempt to
60 remap the resulting system identifier (or the original system
61 identifier if no public identifier was supplied). It will then
62 call the original ExternEnt handler associated with the parser
63 object. PARSER is the parser object; it is needed as an argument
64 in order to obtain the original handler.
65
66 add_delegate($pubid, $href)
67 TBD
68
69 add_extend($href)
70 TBD
71
72 add_extend_object($cat, $group )
73 TBD
74
75 add_map($pubid, $href)
76 TBD
77
78 add_remap($sysid, $href)
79 TBD
80
81 build($url)
82 create new catalog object
83
84 fix_base($url)
85 TBD
86
87 parse
88 TBD
89
90 parse_SOCAT($ct)
91 TBD
92
93 parse_XML($ct)
94 TBD
95
96 set_base($href)
97 TBD
98
100 Searching of chained catalogs is not purely depth-first (EXTEND items
101 in a chained catalog will be searched before EXTEND items in the
102 original catalog.
103
104 Error checking leaves much to be desired.
105
107 Current Author:
108
109 Jeff Fearn E<lt>jfearn@cpan.orgE<gt>.
110
111 Former Authors:
112
113 Eric Bohlman E<lt>ebohlman@netcom.comE<gt>.
114
116 Copyright (c) 1999-2000 Eric Bohlman. All rights reserved. Copyright
117 (c) 2013 Jeff Fearn. All rights reserved.
118
119 This program is free software; you can use/modify/redistribute it under
120 the same terms as Perl itself.
121
122
123
124perl v5.16.3 2013-10-28 XML::Catalog(3)