NAME

XML::Parsepp - Simplified pure perl parser for XML

SYNOPSIS

use XML::Parsepp;

$p1 = new XML::Parsepp;
$p1->parsefile('REC-xml-19980210.xml');
$p1->parse('<foo id="me">Hello World</foo>');

# Alternative
$p2 = new XML::Parsepp(Handlers => {Start => \&handle_start,
                                    End   => \&handle_end,
                                    Char  => \&handle_char});
$p2->parse($socket);

# Another alternative
$p3 = new XML::Parsepp;

$p3->setHandlers(Char    => \&text,
                 Default => \&other);

open(FOO, 'xmlgenerator |');
$p3->parse(*FOO);
close(FOO);

$p3->parsefile('junk.xml');

DESCRIPTION

This module provides a pure Perl implementation to parse XML documents. Its interface is very close to that of XML::Parser (in fact, the synopsis has, with some minor modifications, been copied from XML::Parser).

USAGE

XML::Parsepp can be used as a pure Perl alternative to XML::Parser. The main use case is with XML::Reader where it can be used as a drop-in replacement. Here is a sample:

use XML::Reader qw(XML::Parsepp);

my $text = q{<init>n <?test pi?> t<page node="400">m <!-- remark --> r</page></init>};

my $rdr = XML::Reader->new(\$text) or die "Error: $!";
while ($rdr->iterate) {
    printf "Path: %-19s, Value: %s\n", $rdr->path, $rdr->value;
}

AUTHOR

Klaus Eichner <klaus03@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2011 by Klaus Eichner

All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the artistic license 2.0, see http://www.opensource.org/licenses/artistic-license-2.0.php