use Perl Log In
XML::Tiny
I have been continually frustrated by XML modules. They were all either hard to use, had ridiculous dependencies, took too much memory, or some horrible Lovecraftian combination of those. So, when Adam Kennedy recently muttered on the datetime mailing list about his *::Tiny modules, I decided to do XML right. The result is XML::Tiny, which (according to its documentation) implements a useful subset of XML. Secretly, I think it implements the useful subset.
The core parser is less than 20 lines of code and is sufficient to parse an RSS feed or the responses from Amazon's web services. It should be compatible with perl 5.004_05 and with XML::Parser with the XML::Parser::EasyTree style, has no dependencies outside the core, and consumes as near as damnit no memory.
Related Stories
2007's Top Ten Stories on use.Perl 2 comments
[+]
Here are the top ten most read stories from 2007 on use.Perl:
- XML::Tiny (January 29, drhyde)
- Video and Audio recordings from YAPC::Asia 2007 (April 24, miyagawa)
- Jonathon Rockway throws down the gauntlet on Object::Tiny (September 4, Alias)
- Tired of "Perl is dead" FUD ? (September 14, renodino)
- Perl 6 Design Team Minutes for 07 February 2007 (February 16, chromatic)
- Faces + CPAN == A More Polite Community (September 9, schwern)
- Are we framing"dual-life" modules the wrong way? (September 26, Alias)
- Idea! CPAN Version Advisories (September 17, schwern)
- search.cpan.org Gravatars are go! (September 11, schwern)
- Perl 6 Design Minutes for 09 May 2007 (May 14, chromatic)
Although the numbers aren't that important (so I don't include them), they do roughly follow Zipf's law, and they aren't ranked by date—September seemed to be a good time to write interesting stuff, but also the time that we started posting more stuff to the front page. These are only stories, not journals.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.

Perl 5.004 compatiblity (Score:1)
It should be compatible with perl 5.004_05
Sorry, but it's not because you're using
existson arrays, which wasn't supported until Perl 5.6.$ /usr/local/perl/5.4.5/bin/perl -wc lib/XML/Tiny.pmexists operator argument is not a HASH element at lib/XML/Tiny.pm line 94.
$ /usr/local/perl/5.5.3/bin/perl -wc lib/XML/Tiny.pmexists operator argument is not a HASH element at lib/XML/Tiny.pm line 94.
Close the world. txEn eht nepO
People need to know... (Score:2)
There actually are more new modules (Score:1)
There are many XML modules, but for most of them you have to process XML manually. That is not easy, certainly when you have to read Schema's. The XML specification documents are horribly complex and hard to read. This post gives me the opportunity to plug my own new XML module: http://search.cpan.org/~markov/XML-Compile [cpan.org].
XML::Compile is XML::LibXML based, and uses schema's to create translators between perl and XML. It does validation on values, handles all namespace issues for you, and follows the W3C specs closely. In most cases, you will not need any explicit processing of XML in your script.
The next step is WSDL (this week) and SOAP (hopefully soon). The target is to create a worthy competitor to SOAP::Lite.
XML::Compile needs to age some more, to find flaws. Please try it.
Memory Usage (Score:2)
Well, at least until
parsefile()slurps that 20MB XML file anywayOn how to handle entities (Score:2)
version 1.04 released (Score:2)