[XML-SIG] problem with empty namespace uri
Uche Ogbuji
uche.ogbuji@fourthought.com
Mon, 29 Jan 2001 13:53:08 -0700
> > 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)
IIRC, NULLs are more of a hazard in Java, so perhaps we needn;t worry about
this divergence.
> 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.
Yes. The DOM used to be very confused, allowing both empty string and null,
but they cleaned this up, and 4DOM has followed suit.
--
Uche Ogbuji Principal Consultant
uche.ogbuji@fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python