SVG::Parser::Expat

Section: User Contributed Perl Documentation (3)
Updated: 2008-05-14
Index Return to Main Contents
 

NAME

SVG::Parser::Expat - XML Expat Parser for SVG documents  

SYNOPSIS

  #!/usr/bin/perl -w
  use strict;
  use SVG::Parser::Expat;

  die "Usage: $0 <file>\n" unless @ARGV;

  my $xml;
  {
      local $/=undef;
      $xml=<>;
  }

  my $parser=new SVG::Parser::Expat;

  my $svg=$parser->parse($xml);

  print $svg->xmlify;

 

DESCRIPTION

SVG::Parser::Expat is the Expat-specific parser module used by SVG::Parser when an underlying XML::Parser-based parser is selected. It may also be used directly, as shown in the synopsis above.

Use SVG::Parser to retain maximum flexibility as to which underlying parser is chosen. Use SVG::Parser::Expat to supply Expat-specific parser options or where the presence of XML::Parser is known and/or preferred.  

EXPORTS

None. However, an alternative parent class (other than XML::Parser) can be specified by passing the package name to SVG::Parser::Expat in the import list. For example:

    use SVG::Parser::Expat qw(My::XML::Parser::Subclass);

Where My::XML::Parser::Subclass is a subclass like:

    package My::XML::Parser::Subclass;
    use strict;
    use vars qw(@ISA);
    use XML::Parser;
    @ISA=qw(XML::Parser);

    ...custom methods...

    1;

When loaded via SVG::Parser, this parent class may be specified by placing it after the '=' in a parser specification:

    use SVG::Parser qw(Expat=My::XML::Parser::Subclass);

See SVG::Parser for more details.  

EXAMPLES

See "svgexpatparse" in the examples directory of the distribution.  

AUTHOR

Peter Wainwright, peter.wainwright@cybrid.net  

SEE ALSO

SVG, SVG::Parser, SVG::Parser::SAX, XML::Parser


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXPORTS
EXAMPLES
AUTHOR
SEE ALSO

linux.jgfs.net manual pages