xml : remove a node with dom

alain walter alain.serge.walter at gmail.com
Thu Oct 28 11:37:06 CEST 2010

I have many difficulties to manipulate xml routines. I'm working with
python 2.4.4 and I cannot change to a more recent one, then I use dom
package, why not.
In the following code, I'm trying unsuccessfully to remove a
particular node. It seems to me that it should be basic, but it's
Thanks for your help

toxml="<aixm:VORTimeSlice gml:id="ABB">
      <aixm:ElevatedPoint gml:id="ABB" srsDimension="2">
         <gml:pos srsDimension="2">-51.23 4.6501</gml:pos>
         <aixm:elevation uom="M">xxx_toremove_xxx</aixm:elevation>

from xml.dom.minidom import parse,parseString

dom = parseString(toxml)
print toxml

def ApplicationWhitespaceRemoving(self,ele) :
   from xml.dom import Node
   for c in ele.childNodes:
      if c.nodeType == c.TEXT_NODE:
         if c.nodeValue == "xxx_toremove_xxx":
      elif c.nodeType == ele.ELEMENT_NODE:

More information about the Python-list mailing list