Inserting an element into existing xml file

Stefan Behnel stefan.behnel-n05pAM at web.de
Tue Sep 25 06:20:18 EDT 2007


Anand wrote:
> I'm new to Python. we are using python2.4.
> 
> I wanted to insert an element into an existing xml file. Can anyone
> help me with this?
> I've seen lxml and elementTree in python2.5 has some API's to insert
> into existing xml file.
> We cant use python 2.5 due to some limitations. So how can we do it in
> 2.4?

Install lxml and read the tutorial. It should be easy to grasp, as the API is
very simple.

http://codespeak.net/lxml/tutorial.html
http://codespeak.net/lxml/tutorial.html#elements-are-lists

It's compatible to ElementTree, which you can also install on Python 2.4 (it's
what later became part of Python 2.5).

Stefan



More information about the Python-list mailing list