splitting an XML file on the basis on basis of XML tags

Stefan Behnel stefan_ml at behnel.de
Mon Apr 7 08:34:25 EDT 2008


bijeshn wrote:
> the extracted files are to be XML too. ijust need to extract it raw
> (tags and data just like it is in the parent XML file..)

Ah, so then replace the "print tostring()" line in my example by

    ET.ElementTree(element).write("outputfile.xml")

and you're done.

Stefan



More information about the Python-list mailing list