[XML-SIG] [SOLVED] soapy hacking -- getAttributeNS
Uche Ogbuji
uche.ogbuji@fourthought.com
Sun, 02 Mar 2003 22:35:19 -0700
> On Saturday 01 March 2003 6:42 pm, Uche Ogbuji wrote:
> > Hmm? Not true at all.
>
> [...]
>
> > >>> from xml.dom.ext.reader import Sax2
> > >>> reader = Sax2.Reader()
> > >>> doc = reader.fromString("<root><test xmlns:mb='http://123'
> > >>> mb:name='abc' />
> >
> > </root>")
> >
> > >>> test_node = doc.documentElement.firstChild
> > >>> test_node.getAttributeNS(u'http://123', u'name')
> >
> > u'abc'
>
> Shouldn't it work with minidom?
>
> >>> import xml.dom.minidom
> >>> doc = xml.dom.minidom.parseString("<section xlmns:mb='http://123'
^^^^^
> mb:name='abc'/>")
> >>> doc.childNodes[0].getAttributeNS(u'http://123', u'name')
> ''
Ah, it does work on minidom when you spell "xmlns" correctly :-)
>>> import xml.dom.minidom
>>> doc = xml.dom.minidom.parseString("<section xmlns:mb='http://123'
mb:name='abc'/>")
>>> doc.childNodes[0].attributes.items()
[(u'mb:name', u'abc'), (u'xmlns:mb', u'http://123')]
>>> doc.childNodes[0].getAttributeNS(u'http://123', u'name')
u'abc'
> > BTW, using 4Suite's Domlette, which is *much* faster than 4DOM you would
> use:
> > >>> from Ft.Xml.Domlette import NonvalidatingReader
> > >>> doc = NonvalidatingReader.parseString("<root><test
> > >>> xmlns:mb='http://123'
> >
> > mb:name='abc' /></root>","file:bogus.xml")
> >
> > >>> test_node = doc.documentElement.firstChild
> > >>> test_node.attributes[(u'http://123', u'name')].value
> >
> > u'abc'
>
> I was developing using Python 2.1 and 4Suite and the wsdllib.py library (which
> requires Ft.Lib.pDomlette). When I downloaded the 2.2 4Suite Windows
> installer, there was no pDomlette.py.
pDomlette is no gone. The 4Suite Domlettes have been unified. Is there any
chance you could put together a patch to update wsdllib.py to the API as
detailed in
http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/domlettes
?
Mike and I'd be very grateful, and update the code to help others.
> I suppose I could have used the 0.11 version with Python 2.2 on Windows, but
> it wasn't clear and (at the time) it seemed like a good idea to create a
> small file that reads wsdl and makes soap calls and works with native python
> libraries.
>
> > May I suggest my Python/XML articles? They cover some of the issues you've
> > run into:
> >
> > http://www.xml.com/pub/au/84
>
> I've seen many of these before, thank you for all your work!
>
> > There is also a lot of relevant stuff on my Akara site:
> >
> > http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/pyxml-akara
>
> Hmmm, "Waiting for a reply" ...
Site went psycho for a bit, according to the logs. I've been playing with it
hard latey, trying to generalize Akara into a full-blown (and IMHO very
compelling) app, and stability hs suffered accordingly. Sorry. Anyway, it's
back running now.
--
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/librar
y/x-think15/
4Suite Repository Features - https://www6.software.ibm.com/reg/devworks/dw-x4su
ite5-i/
XML class warfare - http://www.adtmag.com/article.asp?id=6965
See you at XML Web Services One - http://www.xmlconference.com/santaclara/