[XML-SIG] problem with empty namespace uri

Martin v. Loewis martin@mira.cs.tu-berlin.de
Sun, 28 Jan 2001 23:23:24 +0100


> I thought None was an acceptable NSUri in Python SAX2.  The docs
> certainly seem to think so. 

What part of the docs specifically do you refer to, here? I think the
None vs "" business is sufficiently confusing so it needs to be
spelled out explicitly in all places. I do not think that applications
should need to behave polymorphically, accepting either None or "".

For SAX, the only explicit statement I could find is in the Java SAX
spec:

  uri - The Namespace URI, or the empty string if the element has no
  Namespace URI or if Namespace processing is not being performed.
  (http://www.megginson.com/SAX/Java/javadoc/org/xml/sax/ContentHandler.html)

So unless you found documentation that Python has to use None here,
I'd say we have to clarify the SAX API that a missing namespace is
represented as "".

Unfortunately, the DOM specification has that different:

  # Note that because the DOM does no lexical checking, the empty
  # string will be treated as a real namespace URI in DOM Level 2
  # methods. Applications must use the value null as the namespaceURI
  # parameter for methods if they wish to have no namespace.
  (1.1.8 of DOM 2 Core)

This clearly means that a node without namespace has a null
namespaceURI, according to
http://python.sourceforge.net/devel-docs/lib/dom-type-mapping.html,
this maps to None in Python.

If everybody agrees that this is how it should be, we should document
it as such where appropriate, and fix existing implementations
accordingly.

Regards,
Martin