[Tutor] Writing to XML file with minidom

Johan Geldenhuys johan at accesstel.co.za
Mon Aug 22 11:51:00 CEST 2005

Hi all,
I use minidom to parse xml data from a file.
I know how to get the data:

""" Parse the xml file """
            xmlDocument = minidom.parse(self.configFile)
            """ Parse xml main section """
            mainSection = xmlDocument.getElementsByTagName('Config')
            """ Parse xml Global section """
            configSection = mainSection[0]
            """ Parse Ports section """
            socketList = configSection.getElementsByTagName('Sockets')


Now I want to change a string that a retrieved from the file and write
it back to where it was. So, I get something, change it and write it

How do I put the new string in the place of the old? How do I overwrite
the first value with the new value?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050822/aa0ef43d/attachment.htm

More information about the Tutor mailing list