[XML-SIG] Reconsidering NamespaceErr on '' and None
Rich Salz
rsalz@zolera.com
Fri, 14 Dec 2001 09:29:35 -0500
I have an opensource SOAP toolkit that runs on several DOM's: PyXML 0.6,
the planned 0.7, and the FourThought 4dom and cDomlette. I wrote my own
accessors, like this:
_find_attr = lambda E, attr: \
E.getAttributeNS(None, attr) or E.getAttributeNS("", attr)
This now breaks, raising
File "/usr/lib/python2.1/site-packages/_xmlplus/dom/NamedNodeMap.py",
line 81, in getNamedItemNS
raise NamespaceErr("Use None instead of '' for empty namespace")
I think this is a mistake as it makes it difficult to write portable
code.
Instead, I think we should treat [NONE, '', xml.dom.EMPTY_NAMESPACE] as
equivalent for one release, and in 0.8 use an exception.
For now, I'm doing this:
try:
from xml.dom import EMPTY_NAMESPACE
_find_attr = lambda E, attr: \
E.getAttributeNS(EMPTY_NAMESPACE, attr)
except:
# the definition from above
--
Zolera Systems, Your Key to Online Integrity
Securing Web services: XML, SOAP, Dig-sig, Encryption
http://www.zolera.com