XML, the Perl Way

Perl & XML

Perl & XML
author Eric T. Ray & Jason Mc Intosh
pages 202
publisher O'Reilly and Associates
rating 8
reviewer mir
ISBN 0-596-00205-X
summary Simple and clear introduction to the topic

I like Perl & XML. I like its informal style, I appreciate the examples about monkeys and comic books instead of the usual e-commerce. I also like the fact that it strikes the right balance between the "old-generation" modules (based on XML::Parser) and the new ones (SAX-based). It covers the most popular modules and does a good job at explaining how and when to use them.

Other nice points: the discussion of Unicode is pretty good, describing its impact on XML processing and the various ways to do conversions between encodings. The book also includes the right amount of reference material; SAX and SAX2, and DOM. The final chapter offers a bunch of detailed examples that show quite well what a typical XML application is.

Even the description of XML::Twig is good... what else would you (or at least I ;--) ask for?

A couple of minor complaints: the part about the DOM should definitely mention XML::GDOME, which is similar to XML::DOM but based on the GNOME DOM, and is less mature but more actively maintained than XML::DOM. IMHO it should also include a warning about the low-levelness of the DOM API and show some of the pitfalls that can trip un-experienced users (OK, that's one of my pet peeves, but still, a well-placed XML comment or line return can often crash naively designed DOM code). Some problems with the description of Unicode (page 22, latin-1 and Unicode code points are the same (for all 0-255 characters), but UTF-8 and latin-1 are only similar for characters 0-127). I suspect a longer discussion of the respective merits of Perl vs XSLT could also have been useful for some readers, to help them justify sticking with Perl when their management wants them to be buzzword compliant or when to give in and switch to XSLT when appropriate.

Finally it could be argued that the book is quite thin, about 200 pages. The problem is that there are so many modules, and they have so much documentation already, that I think this is the right format: an introduction, that gives the big picture and lets you pick which processing model and ultimately which module to use depending on the specifics of the project at hand. It gives readers enough information to be able to go further, without overwhelming them with tons of details about each module, which can be found in the POD anyway, updated with each new release.

Overall it is a very good introduction, targeted at Perl hackers who are new to XML, or have outgrown XML::Simple. With this book, the Perl-XML FAQ and Kip Hampton's columns on XML.com they should be up-to-speed and ready to do serious XML processing in no time. Although it is probably not essential for people already familiar with the subject I liked the SAX and DOM references, and I was not familiar with all the modules mentioned in the book (who is?). So even if I agree with Robin on the need for an "Advanced Perl and XML" or a "Perl and XML Cookbook" companion I think as it is, it is still useful for me.

Small prints:I was one of the technical reviewer of this book, so I might be considered involved in it. As no one else posted a review I decided to write this one though.