[reportlab-users] preppy with pyRXP

Andy Robinson andy at reportlab.com
Sun Mar 26 15:48:47 EST 2006


will at phototropia.org wrote:
> Friends:
>      Can you point me at examples of Preppy with pyRXP?  Specifically,
> once you have all of the parsed data form an xml file into a pyRXP
> object, have made changes and want to update the original file, do
> you write over the orginal file say with a Preppy template filled in
> with the changed data, or update the changed tags somehow in the
> original file?

Actually we never do anything like that within ReportLab :-(
The bad news is that no one here has used pyRXP or any wrappers to edit 
and write back to an XML file.

The vast majority of the time our business is reading in XML files in 
order to generate RML or HTML.  We use pyRXP, usually wrapped with the 
xmlutils  module in the pyRXP distribution to allow friendly access and 
traversal, to loop over nodes and extract text and attributes.  Often 
these get substituted into a 'template' which is a mixture of preppy 
tags and RML.

For example if you have an XML file with invoice data

<invoice>
   <client> blah blah </client>
   <lines>
     <item category="Travel" amount="123.45"/>
     <item category="Accomodation" amount="234.56"/>
   </lines>
</invoice>


<table>
<tr><td>Category</td><td>Amount</td></tr>
{{for line in invoice.lines}}
<tr><td>{{line.account}}</td><td>{{line.amount}}</td></tr>
{{endfor}}
</table>



Are you trying to store a data structure in XML and rewrite it after 
editing it graphically in your gUI?  If so I think preppy may not help. 
    If you can give me an example of the actual files in question I'll 
try to suggest a clean way to do it.

Best Regards,


Andy Robinson






More information about the reportlab-users mailing list