[XML-SIG] Node as Element?

Ian Sparks ians@etrials.com
Thu, 20 Dec 2001 11:02:39 -0500


This is so simple but it has me stumped.

If I do :

from xml.dom.ext.reader.Sax2 import Reader

...setting up document & y here....

   for x in y.childNodes:
        if x.getAttributeNS('','attribute_name') == 'foo':
           do_something...

I get an error. 

childNodes returns a Nodelist, x is therefore a node but I know its an
Element so how can I cast it to an Element? 

This is where my Python knowledge is weak, I want to do :    

if (x as Element).getAttributeNS('type') == 'foo':
   dosomething...

but I'm afraid that just shows my Delphi roots....What's the Python
solution?

- Ian Sparks.