[XML-SIG] namespace headache
Uche Ogbuji
uogbuji@fourthought.com
Tue, 02 May 2000 16:01:49 -0600
> So the next part of my comment is of no use to you but I'll make it anyway:
> 4DOM does get it right:
>
> [uogbuji@borgia uogbuji]$ python
> Python 1.5.2 (#1, Mar 21 2000, 18:17:19) [GCC 2.95.3 19991030 (prerelease)]
> on linux-i386
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> from Ft.Dom.Ext.Reader import Sax2
> >>> source = """<ns:body xmlns:ns='namespace:'>
> ... <ns:member attribute='value'>
> ... </ns:member>
> ... </ns:body>"""
> >>> doc = Sax2.FromXml(source)
> >>> member = doc.documentElement.childNodes[1]
> >>> member
> <Element Node at 135665768: Name = 'ns:member' with 1 attributes and 1
> children>
> >>> attr = member.attributes[0]
> >>> attr
> <Attribute Node at 134895008: Name = "attribute", Value = "value">
> >>> att.namespaceURI
> >>> attr.localName
> 'attribute'
> >>> attr.nodeName
> 'attribute'
> >>> import Ft.Dom.Ext
> >>> Ft.Dom.Ext.GetAllNs(attr)
> {'ns': 'namespace:', 'xml': 'http://www.w3.org/XML/1998/namespace'}
> >>>
What I get for C n P-ing from a terminal screen chunks at a time. Looks like
not only did I swipe a typo I'd meant to leave out, but I left out 4DOM's
answer to "attr.namespaceURI". For the record, it is '', but of course you
don't have to take my word for it. Give it a try.
--
Uche Ogbuji Senior Software Engineer
uche.ogbuji@fourthought.com +01 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-9036, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python