Best way to do this!

Peter Hansen peter at
Thu Aug 15 03:48:45 CEST 2002

Sunit Joshi wrote:
> Hello All
> I have a situation where I need to compare a couple of XML files like
> this:
> <?xml version="1.0"?>
>   <MODEL>
> and then write out a final xml file like:
> <?xml version="1.0"?>
> <Models>
>   <Model>
>     <modelNo>pipea1m1</modelNo>
>     <discipline>1</discipline>
>     <Site>
>       <ID>Houston</ID>
>       <Status>Not Present</Status>
>     </Site>

Well, my first reaction was to suggest using XSLT, since this is
similar to the types of application for which it is targetted, but
I'm not sure it would be possible.  Where, for example, does 
"Houston" come from?  Your input file does not have it present?
Issue like this might prevent simple use of XSLT.

If the problem is not very complicated, could you just use
the standard Python XML libraries and write a few lines to
accomplish what you need?  It doesn't sound like the "best"
way is what you need, just _a_ way that works...  or are 
there issues like scalability that concern you?


More information about the Python-list mailing list