Please help required urgently - xml.dom.minidom
Graeme
graeme_matthew at hotmail.com
Sat Jan 18 07:34:47 EST 2003
Hi all
I am at the point of exploding, I have been trying to get my head around
xml.dom.minidom
I just cannot seem to get the value for the element/node
My XML is very simple
<Order><OrderId>12345</OrderId><Delivery>Definetly Not Microsoft
Way</Delivery><Order>
When I pass this to my class instance and process it the output is
OrderId
None
1
Delivery
None
1
1
please could someone explain this, many thanks
Here is my class
import xml.dom.minidom
import Order
import OrderLine
class OrderMessageProcessor(object):
def __init__ (self,data=None):
self.order = Order.Order()
self.data = data
def processOrder(self):
xmlTree = xml.dom.minidom.parseString(self.data)
#Get a NodeList Object
orders = xmlTree.getElementsByTagName('Order')
if orders.length != 0:
#Loop nod
for nod in orders:
for elem in nod.childNodes:
print elem.tagName
print elem.nodeValue
print elem.nodeType
xmlTree.unlink()
More information about the Python-list
mailing list