[XML-SIG] soapy hacking -- getAttributeNS

Uche Ogbuji uche.ogbuji@fourthought.com
Sat, 01 Mar 2003 16:18:17 -0700


> Stupid question ... what's the proper way to retrieve the value of the name 
> attribute using pnode.getAttributeNS()?
> 
> >>> pnode = pnodes[0]
> >>> xml.dom.ext.PrettyPrint(pnode)
> 
> <port xmlns='http://schemas.xmlsoap.org/wsdl/' 
> xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:typens='urn:BarCodes' 
> xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
> xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
> xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
> binding='typens:BarCodesBinding' name='BarCodesPort'>
>   <soap:address location='http://www.flash-db.com/services/ws/barCodes.php'/>
> </port>
> >>> pnode.getAttributeNS('', 'name')
> ''
> >>> pnode.getAttribute('name')
> u'BarCodesPort'
> >>> pnode.getAttributeNS('http://schemas.xmlsoap.org/wsdl/', 'name')
> ''
> >>> pnode.getAttributeNS('urn:BarCodes', 'name')
> ''

None represents the empty namespace, not ''.

You should use xml.dom.EMPTY_NAMESPACE

 
-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
The open office file format  - http://www-106.ibm.com/developerworks/xml/library/x-think15/
4Suite Repository Features - https://www6.software.ibm.com/reg/devworks/dw-x4suite5-i/
XML class warfare - http://www.adtmag.com/article.asp?id=6965
See you at XML Web Services One - http://www.xmlconference.com/santaclara/