Inserting an element into existing xml file

A

Anand

Hi,

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?

Thanks in Advance,
Anand
 
S

Stefan Behnel

Anand said:
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
 
A

Anand

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

http://codespeak.net/lxml/tutorial.htmlhttp://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


Hi Stefan,

First of all thanks for your reply.

I'm Afraid to say, I can't use lxml or elementTree as it requires many
legal approvals and there is high chances of not getting it through.
So Do you have any other method / idea just by using plain 2.4 to
accomplish the task

Cheers,
Anand
 
M

Marc 'BlackJack' Rintsch

I'm Afraid to say, I can't use lxml or elementTree as it requires many
legal approvals and there is high chances of not getting it through.

In what environment is it hard to get something BSD licensed through!?

Ciao,
Marc 'BlackJack' Rintsch
 
F

Fredrik Lundh

Anand said:
I'm Afraid to say, I can't use lxml or elementTree as it requires many
legal approvals and there is high chances of not getting it through.
So Do you have any other method / idea just by using plain 2.4 to
accomplish the task

Are you allowed to use code samples you found on the net?

http://svn.effbot.org/public/elementtree/

(if not, are you even allowed to ask for help? ;-)

ElementTree (aka xml.etree) is pure Python, and you only need the
ElementTree.py module to do what you want, so I guess you could
always pretend you wrote it yourself...

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top