XML is a text-based markup language that has taken the programming world by storm. More powerful than HTML yet less demanding than SGML, XML has proven itself to be flexible and resilient. XML is the perfect tool for formatting documents with even the smallest bit of complexity, from Web pages to legal contracts to books. However, XML has also proven itself to be indispensable for organizing and conveying other sorts of data as well, thus its central role in web services like SOAP and XML-RPC.As the Perl programming language was tailor-made for manipulating text, few people have disputed the fact that Perl and XML are perfectly suited for one another. The only question has been what's the best way to do it. That's where this book comes in.Perl & XML is aimed at Perl programmers who need to work with XML documents and data. The book covers all the major modules for XML processing in Perl, including XML::Simple, XML::Parser, XML::LibXML, XML::XPath, XML::Writer, XML::Pyx, XML::Parser::PerlSAX, XML::SAX, XML::SimpleObject, XML::TreeBuilder, XML::Grove, XML::DOM, XML::RSS, XML::Generator::DBI, and SOAP::Lite. But this book is more than just a listing of modules; it gives a complete, comprehensive tour of the landscape of Perl and XML, making sense of the myriad of modules, terminology, and techniques.This book covers:
- parsing XML documents and writing them out again
- working with event streams and SAX
- tree processing and the Document Object Model
- advanced tree processing with XPath and XSLT
Most valuably, the last two chapters of Perl & XML give complete examples of XML applications, pulling together all the tools at your disposal. All together,
Perl & XML is the single book that gives you a solid grounding in XML processing with Perl.
Perl and XML shows how to combine two key Web technologies. Perl is a great language for server-side Web scripting, but XML parsers are generally written in Java or C++. Even so, Perl is everywhere, its strong text processing features make it a good partner for XML, and the chances are that Perl developers will need to work with XML sooner or later. Written with lively good humour, this title explains how to parse, validate and generate XML using a variety of techniques. It does not teach Perl, but does include an excellent short introduction to XML itself.
After setting the scene, the authors set out the basics of XML parsing and writing, using the XML::Parser and XML::Writer modules. This is a good place to start, but the book makes it clear that the future of Perl and XML is in standard interfaces like SAX, which is the subject of another chapter. There is also an explanation of tree processing using XML::Simple or the standard DOM. (Document Object Model). The last chapters cover other XML technologies including XPath, XSLT and SOAP.
Packed with plenty of example code, this title is very much a guide rather than a reference. It does a great job of presenting XML from a Perl perspective, showing why it is useful and how to go about finding and installing the right modules. A couple of short but complete examples at the end help to put it all together, and there are lots of handy tips and warnings sprinkled throughout the book.--Tim Anderson