XML, the Perl Way

XML::DOM::Twig

XML::DOM, The Perl Way

XML::DOM::Twig is an evil hack: it is a helper module that adds XML::Twig methods to XML::DOM.

XML::DOM::Twig I consider it evil because I hate XML::DOM and I think you should not be using it in the first place, there are plenty of good, Perlish modules on CPAN that are much nicer to use and better supported than XML::DOM. That said there are also a lot of people using XML::DOM for various reasons, ranging from the fact that it was one of the first Perl XML module to their boss saying "use the DOM"!. XML::DOM::Twig is designed to help those poor souls.

XML::DOM::Twig just adds a bunch of methods directly taken from XML::Twig to the usual DOM methods.

The most important addition, IMHO, is that navigation methods such as first_child or next-sibling now accept an additional argument, a condition, usually just a tag name, and will return an element with that name. $section->first_child( 'title') is much safer than $section->getFirstChild, which can return anything from the actual section title to the line return after the section tag or to a comment placed between the 2 start tags.

So please use this module, and send me back any comment at m.v.rodriguez@ieee.org. I am especially interested in additional methods that you would like to see ported from XML::Twig, whether you'd rather have it overload regular XML::DOM methods (adding optional arguments) instead of creating new ones, or whether you think I should just ditch the module and forget all about XML::DOM.

Download

WARNING: XML::DOM::Twig is in ALPHA state (it is not even on CPAN yet). It is not well documented, not completely tested and by no means complete. Everything in it could be changed. Are you wrned enough?

XML-DOM-Twig-0.02.tar.gz

Documentation


updated Fri Aug 15 17:15:24 2003homeCopyright � 2000-2003, Michel Rodriguez