XML::Simple for Perl Developers
An anonymous reader writes "XML has become pervasive in the computing world and is buried more and more deeply into modern applications and operating systems. It's imperative for the Perl programmer to develop a good understanding of how to use it. In a surprisingly large number of cases, you only need one tool to integrate XML into a Perl application, XML::Simple. This article tells you where to get it, how to use it, and where to go next."
XML::LibXML is where it's at, it is a) quite a bit faster and b) has a sensible interfce rather than giving you useless empty hashrefs in the middle of a tree.
Stop intellectual property from infringing on me
It only claims to support a subset of XML, and of course it is called "Tiny", so I guess I can understand not supporting CDATA or attributes (...maybe). But for a ">" in a CDATA block to cause it to fail? It doesn't seem very useful.
In my personal experience, Simple is probably the worst implementation of an XML parser in perl. For a simple implementation, I have found Twig to be much more useful, sensible and fast.
This is the same approach that is built-in to the qore language http://qore.sourceforge.net/.
It makes it really easy to manipulate data in XML format.
However, qore supports deserialization of mixed text and data and multiple out-of order elements, XML attributes (imagine parsing a docbook file for example), as well as serialization (conversion of a qore data structure to an XML string) with the same features.
The same limitations regarding streaming input and very large files affect this approach, but in all other common cases, it makes it really remarkably easy to manipulate and create data in XML format using this approach.
(Qore also supports JSON with the same approach -- serialization and deserialization between JSON strings and qore data structures...)
thanks,
David
The Apocalypses and Synopses (which somehow you managed to quote without reading the surrounding context) explain the reasons for the changes.
how to invest, a novice's guide
The author of that article says you'll want to use the magic of perl and XML::Simple because "XSLT can't do arithmetic" and proceeds to do magical things like increase numbers by 20%.
... bizarre. Of course you can do that with XSLT! <xsl:value-of select="whatever * 1.2">
That's just
Then he formats a number -- because XSLT, of course, doesn't have a format-number() function.
Next article -- why you should commute to work in an airplane because, as everyone knows, cars can't turn corners.