wtr2_pyx_simple_plus
perl wtr2_pyx_simple_plus
This example uses the XML::PYX manpage and the XMLin layer on top of it, but stores the initial PYX flow so it can later update it with the error messages.
The code is very similar to wtr2_pyx_simple, but the PYX flow if first
stored in $pyx
, before being passed to XMLin. If errors are found,
$pyx
is used to add the errors (add_errors looks for the end of
the root (Finvoice
) start tag, builds the PYX flow for the errors
element and insert it after the root. The pyx flow is then output using
pyxw
which writes it back as XML.
Creating the PYX for the error element is not really elegant, but it is not that much of a pain either. A simple layer a-la-the XML::Writer manpage could make it even easier, but wasn't deemed necessary here.
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::PYX manpage, the XML::Simple manpage, wtr2_simple
Ways to Rome 2 - Kourallinen Dollareita: http://www.xmltwig.com/article/ways_to_rome_2/