English Japanese Kawa.netxp [Perl] XML::TreePP - A pure Perl implementation for parsing/writing xml file

XML::TreePP module parses XML file and expand it for a hash tree. And also this generates XML file from a hash tree. This module is a pure Perl implementation.
You can also fetch an XML file from remote web server like an XMLHttpRequest object in JavaScript language.
I think that XML::TreePP is enough fast and easy to use!

Released version: XML-TreePP-0.41.tar.gz TARGZ CPAN

Subversion repository: http://xml-treepp.googlecode.com/svn/trunk/XML-TreePP/ SVN

Documents: README README Changes Changes

XML::TreePP Group mailing list is available on Yahoo! Groups.
XML.ObjTree class is a JavaScript port of this module.

Examples

Following example shows you how to parse a XML file and expand it for a hash tree.
You don't have to drive with boring DOM interfaces. See also JKL.ParseXML and XML.ObjTree JavaScript libraries.

    use XML::TreePP;
    my $treepp = XML::TreePP->new();
    my $hash = $treepp->parsefile( "index.rdf" );
    print "URL: ", $hash->{"rdf:RDF"}->{item}->[0]->{link}, "\n";

Next example shows you how to generate a XML file from a hash tree.

    use XML::TreePP;
    my $treepp = XML::TreePP->new();
    my $tree = { rss => { channel => { item => [ {
        title   => "The Perl Directory",
        link    => "http://www.perl.org/",
    }, {
        title   => "The Comprehensive Perl Archive Network",
        link    => "http://cpan.perl.org/",
    } ] } } };
    my $xml = $treepp->write( $tree );
    print $xml;

Benchmark

There are some other similar modules.

ModuleXML 30KBXML 200KBXML 30KB x10 Pure Perl
XML::Parser::Lite::Tree0.08 secs0.36 secs0.40 secs OK (w/SOAP::Lite)
XML::Parser::EasyTree0.14 secs0.49 secs0.53 secs NG (w/XML::Parser)
XML::TreePP0.09 secs0.52 secs0.54 secs OK
XML::Simple0.32 secs1.04 secs0.99 secs NG (w/XML::Parser)
XML::Mini7.17 secsN/A71.08 secs OK

XML::TreePP is fast enough and easy to use!

Comments by AjaxCom

Links

Kawa.netxp © Copyright 2006-2010 Yusuke Kawasaki