XML, the Perl Way


NAME

wtr2_twig_simple


SYNOPSYS

  perl wtr2_twig_simple


DESCRIPTION

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

As this code was written after the wtr2_simple example, it was very, very easy to write. I blatantly cheated ;--): it uses XML::Twig simplify method, which generates the same data structure as XML::Simple for a document (or an element) (available only in XML::Twig 3.10). So once the XML document is parsed in memory a call to that method gives me a data structure that can be processed with exactly the same code as in wtr2_simple.

The original document is still in memory though, which makes it possible to update it with the error messages and output it.

Note that in this example the only modification of the original document is the addition of the error messages. If I had needed to change data within the document before outputing it (for example to link the error messages to the place where th error occurs), then I would have had to access it using XML::Twig methods, see wtr2_twig.


AUTHOR

Michel Rodriguez <mirod@xmltwig.com>


LICENSE

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


SEE ALSO

the XML::Twig manpage, the XML::Simple manpage, wtr2_simple

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