alain walter
Usenet Archive
- Joined
- Oct 28, 2010
- Messages
- 2
- Reaction score
- 0
Hello,
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 not.
Thanks for your help
toxml="<aixm:VORTimeSlice gml:id="ABB">
<aixm:type>ABB</aixm:type>
<aixm:designator>ABB</aixm:designator>
<aixm:ElevatedPoint gml:id="ABB" srsDimension="2"> <gml
os srsDimension="2">-51.23 4.6501</gml
os> <aixm:elevation uom="M">xxx_toremove_xxx</aixm:elevation> </aixm:ElevatedPoint> </aixm:VORTimeSlice>"
from xml.dom.minidom import parse,parseString
dom = parseString(toxml)
self.ApplicationWhitespaceRemoving(dom)
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":
???.removeChild(???)
elif c.nodeType == ele.ELEMENT_NODE:
self.ApplicationWhitespaceRemoving(c)
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 not.
Thanks for your help
toxml="<aixm:VORTimeSlice gml:id="ABB">
<aixm:type>ABB</aixm:type>
<aixm:designator>ABB</aixm:designator>
<aixm:ElevatedPoint gml:id="ABB" srsDimension="2"> <gml
from xml.dom.minidom import parse,parseString
dom = parseString(toxml)
self.ApplicationWhitespaceRemoving(dom)
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":
???.removeChild(???)
elif c.nodeType == ele.ELEMENT_NODE:
self.ApplicationWhitespaceRemoving(c)