[ANNOUNCE] XML::SAX::2Simple
by Barrie Slaymaker other posts by this author
Jan 15 2002 6:25PM messages near this date
view in the new Beta List Site
Re: Q: XML Iterators
|
Re: [ANNOUNCE] XML::SAX::2Simple
file: $CPAN/authors/id/R/RB/RBS/XML-Handler-2Simple-0.1.tar.gz
NAME
XML::Handler::2Simple - SAX => XML::Simple handler
SYNOPSIS
my $h = XML::Handler::2Simple-> new(
%xml_simple_options,
DataHandler => \&sub_to_handle_result, ## optional
);
my $p = XML::SAX::ParserFactory-> parser( Handler => $h );
my $data_struct = $p-> parse_uri( $file );
DESCRIPTION
This module accepts a SAX stream and converts it in to a Perl data
structure using XML::Simple. The resulting object can be passed to a
subroutine and is returned after the parse.
For example, here's a SAX machine that outputs all of the records in a
record oriented XML file:
use XML::Handler::2Simple;
use XML::SAX::Machines qw( ByRecord );
use IO::Handle; ## Needed because LibXML uses it without loading it
use Data::Dumper;
$Data::Dumper::Indent = 1; ## Clean up Data::Dumper's output a wee bit
$Data::Dumper::Terse = 1;
$Data::Dumper::Quotekeys = 1;
ByRecord(
XML::Handler::2Simple-> new(
DataHandler => sub {
warn Dumper( $_[1] );
},
)
)-> parse_file( \*STDIN );
AUTHOR
Barrie Slaymaker <barries@[...].com>
COPYRIGHT
Copyright 2002, Barrie Slaymaker, All Rights Reserved.
You may use this module under the terms of any of the Artistic, GNU
Public, or BSD licenses, your choice.
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
http://listserv.ActiveState.com/mailman/listinfo/perl-xml
Thread:
Barrie Slaymaker
Sam Tregar
Barrie Slaymaker
|