A
Alexandre
Hello all,
Could someone explain to me why there is no nextElement in minidom ?
if i execute this :
***************************************
import xml.dom.minidom
doc = """\
<root>
<item>content1</item>
<item>content2</item>
</root>"""
dom = xml.dom.minidom.parseString(doc)
firstItem = dom.getElementsByTagName("item")[0]
nextItem = firstItem.nextSibling
print nextItem
***************************************
the result is :
<DOM Text node "
">
so if i want the next element i could use "firstItem.nextSibling.nextSibling"
or write my own nextElement :
***************************************
def nextElement(current):
pointer = current.nextSibling
if pointer.nodeType == pointer.ELEMENT_NODE:
return pointer
elif pointer == None:
return None
else: return getNextElement(pointer)
***************************************
But i'm wondering if i am not missing something obvious ?
Thx in advance for your help.
Alexandre
Could someone explain to me why there is no nextElement in minidom ?
if i execute this :
***************************************
import xml.dom.minidom
doc = """\
<root>
<item>content1</item>
<item>content2</item>
</root>"""
dom = xml.dom.minidom.parseString(doc)
firstItem = dom.getElementsByTagName("item")[0]
nextItem = firstItem.nextSibling
print nextItem
***************************************
the result is :
<DOM Text node "
">
so if i want the next element i could use "firstItem.nextSibling.nextSibling"
or write my own nextElement :
***************************************
def nextElement(current):
pointer = current.nextSibling
if pointer.nodeType == pointer.ELEMENT_NODE:
return pointer
elif pointer == None:
return None
else: return getNextElement(pointer)
***************************************
But i'm wondering if i am not missing something obvious ?
Thx in advance for your help.
Alexandre