Changing Element Value in Existing XML File Using DOM

Posted by rylic38 on Stack Overflow See other posts from Stack Overflow or by rylic38
Published on 2010-03-18T18:07:44Z Indexed on 2010/03/18 18:11 UTC
Read the original article Hit count: 428

Filed under:
|

Hi All,

I am trying to find examples of how to change an existing xml files Element Value.

Using the following xml example:

<book>
  <title>My Book</title>
  <author>John Smith</author>
</book>

If I wanted to replace the author element value 'John Smith' with 'Jim Johnson' in a Python script using DOM, how would I go about doing so? I've tried to look for examples on this, but have failed in doing so. Any help would be greatly appreciated.

Regards, Rylic

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml