[Chicago] modifying xml ?

Phil Robare verisimilidude at gmail.com
Sat Oct 16 04:21:26 CEST 2010

xslt was a technology invented to do just this sort of processing.  I
think it didn't catch on as well as it should have because the code
for the program is also written in XML.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:output method="xml">
<xsl:template match="/">

... and so on.  The idea is you have two xml documents and data from
one is inserted into the other. I haven't done anything with it in
Python (or even know if there are any libraries), but in Java you can
make calls out to java routines to pass in selected elements and pass
back replacements.  Modern browsers have xslt built in and can do the
transformation client side (again, know it works, haven't done it).
Like most coding, once it works its magic.

What you've outlined seems perfect, trying to do much elaborate stuff
gets you tripping over the XML format in the code.


On Wed, Oct 13, 2010 at 4:06 PM, Lukasz Szybalski <szybalski at gmail.com> wrote:
> Hello,
> I'm trying to modify some big xml by replacing the data with my data.
> Find node and replace "last name" ,"first name"....order detail, where
> order details might have multiple children.
> Are there any useful tutorials or sample code  for doing that with lxml
> I would like to pull up the object like:
> Root.Customer.someSubNode.Order.Product = 'this is a new name'
> I'm not trying to build a new xml, I'm just modifying an existing xml,
> replacing data, and passing that along.
> What would be the easiest way to do this?
> Thanks,
> Lucas
> --
> Need Quality Hardwood Floors at reasonable prices?
> http://www.azrichardflooring.com/
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

More information about the Chicago mailing list