http://qs321.pair.com?node_id=213023
Order XML and Perl

Item Description: Intermediate introduction to XML using Perl modules.

Review Synopsis: Solid new entry in the field.

Summation

XML and Perl by Mark Riehl and Ilya Sterin from New Riders, is the second book to deal with this combination. The first, Perl & XML by Erik T. Ray and Jason McIntosh from O'Reilly predates it by a little less than 6 months. Not a stampede by any means, but enough of a buzz to indicate an interest. The latest addition weighs in at 376 pages of reasonably dense text. Of the two books, XML and Perl is both longer (by 174 pages) and more detailed. The more cautious reader will buy both, the cheaper will buy just this one. As always, there is no substitute for hands-on, under-the-hood experience, but even so, this book will be a useful part of the boot-strap process for those coming up to speed in this area.

The Details

With 5 sections and 10 chapters, XML and Perl is the most detailed survey of the field yet published. Is it detailed enough? Hard to say, for some probably yes, for the rest probably not. It all depends on needs and expectations. This isn't a silver platter, but it is a pretty good brunch. Despite the two appendices to the contrary, this book isn't an introduction. The authors clearly state:
“This book is not intended to be your first book on programming, and it is not going to teach you Perl or XML. We assume that the reader has a basic programming knowledge of Perl and an understanding of XML. Our task is to show you how to use these two technologies together. ”

Perhaps someone a bit more picky than I would have suggested that if the authors were serious about the 'basic knowledge and understanding' thing then they should have skipped chapter 1---since it is a brief survey of both Perl and XML. I just look at it as being thorough! That said, the real meat doesn't get served until chapter 2. Even better, it starts at the right end of the table! With what amounts to something on par with 'C's 'hello world\n', they begin with a simple model and use XML::Simple and Data::Dumper to make a solid but still approachable beginning. One of my pet peeves in the world of 'how-tos' and other surveys is that they mostly don't make a reasonable assumption about where to start. Either they begin in the deep end by handing you an anchor and shouting 'SWIM!' or they bore you to death with endless beginner material. XML and Perl makes a pleasant exception to that trend.

Chapter 3 introduces the continental divide of XML, DOM versus SAX. Or more accurately the Document Object Model versus the Simple API for XML. Access by structure or access by event, both have their advantages and disadvantages, as discussed by the authors. Since this is the kind of material that leads rapidly to internecine programmer warfare, they wisely avoid siding with one or the other, making for an even handed introduction to both. One shouldn't take the fact that most of the chapter is about SAX and SAX2 based approaches as an indicator---chapter 4 is devoted to tree-based modules.

Section III goes into some detail on generating XML (useful, having shown you in section II what to do with it) and Section IV is the typical (but still valuable) advanced stuff section. A kind of what's next view of the more complex XML based concepts. I don't mean to blow off the second half of the book---rather think of it as avoiding the 'spoiler' problem inherent in a review! Besides if I'm tired of writing it follows that you should be tired of reading...


Other

Modules Mentioned1

  • Data::Dumper
  • DBD::CSV
  • DBD::MySQL
  • DBI
  • Frontier::RPC
  • SOAP::Lite
  • XML::DBMS>
  • XML::DOM
  • XML::Generator::DBI
  • XML::Handler::YAWriter
  • XML::LibXML
  • XML::LibXSLT
  • XML::NameSpaceSupport
  • XML::Parser::PerlSAX
  • XML::Parser
  • XML::Sablotron>
  • XML::SAX::Expat
  • XML::SAX::PurePerl
  • XML::SAX
  • XML::SAXDriver::CSV
  • XML::SAXDriver::Excel
  • XML::Simple
  • XML::Twig
  • XML::Writer
  • XML::Xerces
  • XML::Xpath

Table of Contents

  1. The Foundation
    1. Basics of XML Processing in Perl
    2. Now Let's Start Digging
  2. Parsing XML Documents Using Perl
    1. Event-Driven Parser Modules
    2. Tree-Based Parser Modules
  3. Generating XML Documents Using Perl Modules
    1. Generating XML Documents from Text Files
    2. Generating XML Documents from Databases
    3. Transforming Miscellaneous Data Formats to XML (and Vice-Versa)
  4. Advanced XML and Perl
    1. XML Transformation and Filtering
    2. AxKit
    3. Perl and XML Web Services
  5. Appendices
    1. What is XML?
    2. Perl Essentials

BibTeX Data

@book{Riehl+Sterin:1,
  author={Mark Riehl and Ilya Sterin},
  title={XML and Perl},
  publisher={New Riders},
  address={Indianapolis, IN},
  edition={1st},
  year={2002},
  ISBN={0735712891},
}

Links

1Hardly exhaustive!
2At the time of this review (2002.11.11.13:50) this link was broken. They don't call it errata for nothing!

Replies are listed 'Best First'.
Re: XML and Perl
by princepawn (Parson) on Nov 14, 2002 at 22:06 UTC
    You mean they didn't mention XML::TreeBuilder ? I love that module. It has the same API as HTML::TreeBuilder which allows me to grok HTML or XML with about the exact same API. Also it is a beautiful example of subclassing. He just had to make the elements of XML::TreeBuilder more restrictive.

    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

      It's not a widely used module in the community.

      More people use XML::LibXML (in the Perl and XML community), which also supports the same API for both HTML and XML.

        One cool thing about XML::TreeBuilder is the objectify_text method, which turns plain text nodes into pseudo-tags so you can drill down thru the XML and look for particular text.

        Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

Re: XML and Perl
by pelagic (Priest) on Feb 03, 2004 at 13:21 UTC
    After exchanging mail with newriders I got a hint and found the errata and download pages to this book.
    pelagic