« Analyst Suggests that RIM Should Buy Handspring | Main | Why CTDATA Switched from SOAP to XML Over HTTP When Using Amazon Web Services »

XML::Twig Cleanly Picks Elements Off of XML Documents

Dave Aiello wrote, "I've been working with Amazon Web Services again recently. In the course of doing so, I found that using regular expressions to extract elements (data fields) from XML documents doesn't work reliably. I looked through my copy of
Perl & XML
and saw reference made to a number of XML processing modules. For example: XML::Parser, XML::LibXML, XML::XPath, XML::Writer, XML::SAX, XML::Simple, etc."

"My task was to extract only a few elements from each XML document. Some of the documents contained sets of nodes, so they would have multiple instances of the same node."

"The easiest, most efficient, and most "perlish" way of handling this turned out to be using XML::Twig. I found a really good article about XML::Twig on XML.com. It does the job and provides the kind of TMTOWTDI that experienced Perl users expect from a Perl module."

"Perl and XML is a very good book, but, it's surprising that a module as useful as XML::Twig was left out of it. I'd recommend taking a fresh look at all the Perl XML modules whenever you set out to solve a type of XML problem that's new to you."

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


CTDATA Venutures (CTDATA) develops Internet and Intranet applications for corporations and non profit organizations. Our services include:

  • Consulting services for Movable Type and TypePad-based publishing systems (visit our Weblog Improvement website for more information),
  • Financial services business process consulting,
  • Content management system and knowledge management system consulting,
  • Apache web server engineering and hosting,
  • MySQL, Sybase, and Microsoft SQL Server architecture and development,
  • SOAP, REST, and XML-RPC system architecture and programming, including Amazon Web Services and
  • Weblog publishing.
For more information, contact Dave Aiello by email at dave [at] daveaiello.com or call him at +1-267-352-4420.
Copyright © 1995-2010, CTDATA Ventures. All Rights Reserved.
Powered by
Movable Type 4.25