Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Perl Books Media Programming Book Reviews

Perl and XML 74

prostoalex writes: "In the world of information technology, information, as the name suggests, is as important as technology itself. Erik T. Ray's and Jason McIntosh's Perl and XML is an attempt to take a look at perhaps the most popular languages for data processing. XML is an open-standard specification for documents, while Perl's natural powers lie in the area of data processing, and, as the name suggests, practical extracting and reporting." Prostalex has reviewed Perl & XML below; read on for his take on the book.
Perl and XML
author Erik T. Ray, Jason McIntosh
pages 216
publisher O'Reilly
rating 4/5
reviewer Alex Moskalyuk
ISBN 059600205X
summary Introduction to XML processing with Perl

With qualities like these, one might think that the marriage of Perl and XML would be total bliss, and the two languages would live happily ever after. In reality, however, the marriage has been far from perfect, and has produced an enormous number of kids: some uglier, some prettier, some simpler, some more sophisticated. Perl & XML is a good attempt to provide an overview of XML processing techniques existing nowadays in the Perl world.

The book does not even make an attempt to give you a brief introduction to Perl, and thus eliminates the weak point of trying to be another Camel book, as many publications in the field attempt to do. The logical assumption is that you know Perl and have heard something about XML. The first chapter of the book tells you why there are so many variations of Perl modules for XML processing, who is behind the well-known modules and why the interaction of Perl with XML has been rather disorganized. Indeed, a short visit to the XML section of CPAN brings up dozens of available modules, most of which characterized by some intimidating or non-descriptive names like SAX, Grove, YAWriter, etc.

The second chapter is titled "XML Recap"; the contents of the chapter, though, are good enough to be called "Concise but Informative Introduction to XML". Don't get your expectations too high -- O'Reilly has a whole bundle of books related just to learning XML, and thus a single chapter can barely touch the surface of what you might need to know, but it provides a good introduction to the world of markup, elements, namespaces, character encoding, processing instructions, schemas and transformations in XML.

Chapter 3 goes from theory to practice, and gives the reader an opportunity to try his first Perl script on XML data. The parsers covered in this chapter are XML::Parser, XML::LibXML, XML::XPath and XML::Writer. Document validation and well-formedness are also explained, and luckily enough this exact chapter is what O'Reilly Publishing decided to publish as a free chapter available on the Web. In this chapter, the authors make a distinction between stream-based and tree-based XML processing, and thus it doesn't come as a big surprise that the next four chapters are dedicated to examples of such processing.

Chapter 4, Event Streams, discusses the issues of processing XML document as a stream of data, where your application has to react to various input without really knowing where the end of the document is. XML::PYX and XML::Parser are covered in this chapter.

Chapter 5 shows examples of using SAX for XML processing with Perl, and also provides an overview of SAX history, which in a nutshell tells you that SAX has been designed for Java with its strong type checking and interface classes. It goes to explain that using it in Perl, which is known for its forgiving nature, thus requires a certain responsibility on the part of programmer. XML::Handler::YAWriter is also discussed in this chapter.

From stream processing, the authors take you to parsing XML trees. In this case, the document is assumed to be loaded into memory and Perl script can safely assume that the whole XML document has been loaded. XML::Simple, XML::SimpleObject, XML::TreeBuilder and XML::Grove are discussed in this chapter, with XML::Parser revisited.

DOM (Document Object Model) is another standard recommended by W3C and it is mostly concerned with how an XML document is stored in computer's memory. XML::DOM is discussed in this chapter with XML::LibXML revisited. The authors also provide a good overview of DOM standard.

The last three chapters deal with applications of Perl in XML data processing that go beyond stream and tree processing -- XPath and XSLT are explained with copious examples. Remember though, that both technologies have several-hundred-page books written about them, and thus several pages in a Perl and XML book can serve at best as good introduction. Chapter 9 deals with RSS and writing SOAP with Perl and XML, with XML::RSS and SOAP::Lite being explained. The last chapter deals with such issues as namespacing, subclassing and for Web designers provides a handy tutorial on converting your XML data into HTML via XSLT stylesheets.

The table of contents is posted on the publisher's Web site.

The first three chapters of the book are easy to read, since they provide a general overview of the data-processing world, history of XML with reference to appropriate events in the Perl community. However, data processing can hardly be called an exciting topic and thus bulk of the book is about routinely introducing particular modules, telling you what you can do with each, and then giving you an example of Perl code processing some XML document. The examples are apt and relate to some of data processing that some us had to do, i.e. shopping lists, address books, recipes, diaries of mad professors, etc.

The code examples are numerous, and if you get tired after looking at pages and pages of Perl lines, you better plan accordingly, as sometimes the subchapter consists of nothing more than an XML file and related Perl processing code with author's notes. For a 200-page book Perl and XML provides a great introduction into the area, provided you have good knowledge of Perl, using CPAN modules and just general knowledge about data processing. The book would probably have a more exact title if it had the word "Cookbook" in its name -- some might consider it a good reference. However, for those just getting acquainted with XML, another tutorial might be needed to get a full comprehension of XML's power.


You can purchase Perl & XML from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.

Perl and XML

Comments Filter:
  • Great book! (Score:4, Funny)

    by legLess ( 127550 ) on Thursday August 22, 2002 @11:17AM (#4119416) Journal
    It's so good, it gets two reviews [slashdot.org]!
    • by kisrael ( 134664 ) on Thursday August 22, 2002 @11:33AM (#4119535) Homepage
      Well, given that XML tends to be a bit redundant, I guess it's only fitting...
    • dummy, they're TOTALLY different,......

      This book:
      Pages: 216
      Rating: 6
      Pub: O'Reilly
      Summary: Introduction to XML processing with Perl

      That book:
      Pages: 202
      Rating: 4/5
      Pub: O'Reilly and Associates
      Summary: Good introduction to XML for Perl programmers.

      ....and quite frankly the ONLY thing those two books have similar (and this is a longshot) is that ISBN # thingy....

      next time PLEASE read the article before posting.
    • Having multiple opinions about something is often a good idea for many things. It might not be as important for book reviews as it is for say, removing your gall bladder or getting rotator cuff repair, but it's still sortof nice.

      The alternative -- "Isn't one opinion good enough for anything?" -- seems rather frightening to me.
  • I thought Perl's name suggested that it was good at being pathologically eclectic and rubbish listing.
  • Is this book anything like this book [slashdot.org] with the same name and authors. This one's published by O'Reilly, the other was published by some group called O'Reilly and Associates. Hmmm maybe that's the difference.
  • by JasonMaggini ( 190142 ) on Thursday August 22, 2002 @11:34AM (#4119545)
    This review is "Perl and XML". The other review was "Perl & XML". Big difference.
  • Does XML make Perl obsolete or Perl makes XML obsolete.
  • Oh good! (Score:1, Troll)

    by Pig Hogger ( 10379 )
    So, will PERL programs will now be able to be written in XML and appear more logical and well-structured???
    • Where did you get it?

      BTW it is Perl, not PERL.

  • Samples, Learning (Score:5, Insightful)

    by fm6 ( 162816 ) on Thursday August 22, 2002 @12:52PM (#4120239) Homepage Journal
    The sample chapter on the O'Reilly site contains a lot of what I dislike about about O'Reilly books: too much cuteness, not enough organization, too many useless examples. The last are particularly dumb: you don't want to do your own XML parsing, the authors say repeatedly that you don't want to do your own parsing -- yet most of the examples are parsing code!

    It's also dumb to have any introductory XML material if you're not going to be serious about it. Which gives me an excuse to plug my favorite XML for beginners book, Harold's XML Bible, 2nd edition [amazon.com]. Yeah, stupid title (who are you, Moses?), and the CD-ROM is badly put together (you'll need to convert some text files from Mac format!). But the book itself is very good. No assumptions at all about previous knowledge If you know jack about XML, or you understand the basics, but can't figure out how it's used, this is the book you want.

    • Re:Samples, Learning (Score:2, Interesting)

      by Wiggins ( 3161 )
      "The sample chapter on the O'Reilly site contains a lot of what I dislike about about O'Reilly books: too much cuteness, not enough organization, too many useless examples. The last are particularly dumb: you don't want to do your own XML parsing, the authors say repeatedly that you don't want to do your own parsing -- yet most of the examples are parsing code! "

      O'Reilly chose a poor example chapter. The examples of how to do parsing are important in the context of understanding what the modules are doing and being able to determine when one should use which module, which is much of what the book is about.

      "It's also dumb to have any introductory XML material if you're not going to be serious about it"

      Thats the beauty of this particular book, they are "serious about it" they are serious about it being an introduction. For myself who has read about XML standards existing and been doing web development I didn't need an all encompassing book about what the hell a markup language is and how they are generally formatted, etc. and all of the minute details in the XML spec, what I needed was a very concise overview about what DOM, SAX, XSL, etc. are and where they are applied. Which was accomplished beautifully in this particular book.

      Having said all of that I very much appreciated the book as a perfect fit for someone with a fair amount of Perl experience, lots of web experience, but no XML experience. Only fault I found was the price, but that is O'Reilly NOT the author or the text itself.

  • I wonder if this book was ever reviewed before??? Its strange to think that more than one person would want to review the same book. Theres gotta be patent laws against that or something. Right?

As of next Thursday, UNIX will be flushed in favor of TOPS-10. Please update your programs.

Working...