1SVG::Parser::Expat(3) User Contributed Perl DocumentationSVG::Parser::Expat(3)
2
3
4
6 SVG::Parser::Expat - XML Expat Parser for SVG documents
7
9 #!/usr/bin/perl -w
10 use strict;
11 use SVG::Parser::Expat;
12
13 die "Usage: $0 <file>\n" unless @ARGV;
14
15 my $xml;
16 {
17 local $/=undef;
18 $xml=<>;
19 }
20
21 my $parser=new SVG::Parser::Expat;
22
23 my $svg=$parser->parse($xml);
24
25 print $svg->xmlify;
26
28 SVG::Parser::Expat is the Expat-specific parser module used by
29 SVG::Parser when an underlying XML::Parser-based parser is selected. It
30 may also be used directly, as shown in the synopsis above.
31
32 Use SVG::Parser to retain maximum flexibility as to which underlying
33 parser is chosen. Use SVG::Parser::Expat to supply Expat-specific
34 parser options or where the presence of XML::Parser is known and/or
35 preferred.
36
37 EXPORTS
38 None. However, an alternative parent class (other than XML::Parser) can
39 be specified by passing the package name to SVG::Parser::Expat in the
40 import list. For example:
41
42 use SVG::Parser::Expat qw(My::XML::Parser::Subclass);
43
44 Where My::XML::Parser::Subclass is a subclass like:
45
46 package My::XML::Parser::Subclass;
47 use strict;
48 use vars qw(@ISA);
49 use XML::Parser;
50 @ISA=qw(XML::Parser);
51
52 ...custom methods...
53
54 1;
55
56 When loaded via SVG::Parser, this parent class may be specified by
57 placing it after the '=' in a parser specification:
58
59 use SVG::Parser qw(Expat=My::XML::Parser::Subclass);
60
61 See SVG::Parser for more details.
62
63 EXAMPLES
64 See "svgexpatparse" in the examples directory of the distribution.
65
67 Peter Wainwright, peter.wainwright@cybrid.net
68
70 SVG, SVG::Parser, SVG::Parser::SAX, XML::Parser
71
72
73
74perl v5.32.0 2020-07-28 SVG::Parser::Expat(3)