xml.dom.minidom

Graeme gsmatthew at ozemail.com.au
Sat Jan 18 23:04:57 EST 2003


Hi all, thanks to all those who helped yesterday ...

I now need to get my orderlines, from my order xml

for example:

<order>
<orderId>12345</orderId>
<name>Test</name>
<orderlines>

    <orderline>
        <partno>12345</partno>
        <qty>123</qty>
    </orderline>

    <orderline>
        <partno>12346</partno>
        <qty>125</qty>
    </orderline>
</orderlines>
<order>

I keep on getting the first child been returned for example

def __getOrderLineElements(self,orderNode):

        try:
            return orderNode.getElementsByTagName('OrderLines')
        except:
            return None

Is there a way to find out how many child descendents there are i.e
orderlines for the one order as I thought about looping them
and doing it as follows -> return
orderNode.getElementsByTagName('OrderLines')[n]

surely all orderline items must belong to the OrderLines node / element ?

any help would be good

Thanks

Graeme






More information about the Python-list mailing list