Re: [ANNOUNCE] XML::SAX::2Simple
by Duncan Cameron other posts by this author
Jan 15 2002 8:40PM messages near this date
view in the new Beta List Site
Re: Stripping UTF8 from variables.
|
Re: [ANNOUNCE] XML::SAX::2Simple
Barrie
How is this different to XML::SAX::Simple which Matt announced
recently?
Two points:
1) shouldn't this be within the XML::Simple namespace, e.g.
something like XML::Simple::Builder. In fact I thought that I read
that Grant McLean was already working on this.
2) aren't we in danger of namespace overload/confusion with all the
recent packages, i.e. XML::SAX::Machines, XML::Handler::xxx and
XML::Filter::xxx.
Maybe everthing to do with machines should be within the XML::SAXMachines
namespace, and XML::Filter and XML::Handler should contain only
general purpose handlers or filters.
I've not read the docs with all your new packages so I might be just
confusing myself.
Regards,
Duncan Cameron
On 2002-01-15 Barrie Slaymaker <barries@[...].com> wrote:
> 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:
Duncan Cameron
Barrie Slaymaker
Terrence Martin
|