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.
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;
There are some other similar modules.
Module | XML 30KB | XML 200KB | XML 30KB x10 | Pure Perl |
---|---|---|---|---|
XML::Parser::Lite::Tree | 0.08 secs | 0.36 secs | 0.40 secs | OK (w/SOAP::Lite) |
XML::Parser::EasyTree | 0.14 secs | 0.49 secs | 0.53 secs | NG (w/XML::Parser) |
XML::TreePP | 0.09 secs | 0.52 secs | 0.54 secs | OK |
XML::Simple | 0.32 secs | 1.04 secs | 0.99 secs | NG (w/XML::Parser) |
XML::Mini | 7.17 secs | N/A | 71.08 secs | OK |
XML::TreePP is fast enough and easy to use!