[XML-SIG] problem with empty namespace uri

Thomas B. Passin tpassin@home.com
Mon, 29 Jan 2001 09:32:45 -0500


Lars Marius Garshol wrote -
>
> My opinion is that names that have no namespace URI should be
> represented using None rather than "".
>
I completely agree with this.  If there is ***no*** namespace, the ns value
should be None.  The empty string should indicate that there is a namespace,
but its value happens to be empty.

Illustrations seem to be like this - someone help me out here, please.

1) No namespace is declared or used in the whole document, but SAX2 is in use.
(ns='')
2) SAX 1 is in use. (ns=None)
3) Namespaces are used in the document, but not in some particular element.
(ns='' for that element)
4) Namespaces are used in the document, but some particular element is a child
of an element that declares a default namespace. (ns=default ns for that
element).

This leaves open the ns for an attribute in an element that declare a default
ns - the old question that comes up over and over.  I don't know the answer.

Maybe tests like this:

if ns:
    # Do  your namespace stuff

wouldn't add that much to the processing time.  They would act the same on
None and '' ns values.  Of course, you could say, then why make a distinction.
Maybe we don't need to.

I thought this had been hashed out and resolved on the list a while ago,
although I don't remember the details.  This would be a perfect subject for
one of those PEP-like pages I proposed a while ago.  I'd like to resurrect
that suggestion, and have this topic be the subject of the first one.  What do
you say?

Cheers,

Tom P