XML, the Perl Way




  perl wtr2_libxml_dom


This code uses the XML::LibXML manpage to process the invoices

It is directly derived from the the XML::DOM manpage code in wtr2_dom. It only differs where XML::DOM and XML::LibXML DOM methods or constants have different names:

  XML::DOM        XML::LibXML
  getNodeName     nodeName       method
  #text           text           constant returned by nodeName/getNodeName

This was very easy to write, but does not take advantage of XML::LibXML's best feature: its support for XPath. See wtr2_libxml for a slightly different version, made a lot safer by using XPath queries instead of navigation methods (like getFirstChild) to access the data.

This exemple is here just to show how easy it is to port code from XML::DOM (which IMHO should be deprecated) to XML::LibXML, and then take advantage of XML::LibXML more powerful features.


Michel Rodriguez <mirod@xmltwig.com>


This code is Copyright (c) 2003 Michel Rodriguez. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Comments can be sent to mirod@xmltwig.com


the XML::LibXML manpage, the XML::DOM manpage, wtr2_libxml, wtr2_dom

Ways to Rome 2 - Kourallinen Dollareita: http://www.xmltwig.com/article/ways_to_rome_2/