[XML-SIG] SAX namespaces discussion status

Lars Marius Garshol larsga@garshol.priv.no
05 Jul 2000 09:40:54 +0200


* Uche Ogbuji
| 
| Basically, if someone were writing a generic app with different
| actions in namespace and non-namespace mode, they would have to have
| a conditional such as:
| 
| def startElement( self, name, qname, attrs ):
|     if type(name) == type(()):
|         uri, lname = name
|         #namespace processing
|     else:
|         #non-namespace processing
| 
| Not the end of the world, of course, but we must remember that there
| are applications, filters, for example, that would have to deal with
| either mode.

I agree that this is awkward, but I wonder how common it will be.  It
seems to me that in most of these cases the name would be used for
comparisons and for dictionary lookups. These can all be done with no
knowledge of the mode or any special handling for the different modes.

The typical case, I guess, is filters. I think their services will
usually fall into the following categories:

 - names are only compared with configuration values and other names
   already passed from the parser: no problem

 - names are not examined at all: no problem

 - names are compared with fixed element names built-in to the filter,
   such as in the case of filters that implement XInclude or XBase. In
   these cases namespace processing is required, so there is no need
   for mode awareness. 

In the rare case that mode awareness is needed with respect to
literals the filter can use the startDocument callback to query the
parser with regards to the namespace processing setting and set its
internal literals accordingly.

So I can't really think of any common cases where this kind of action
is necessary. If anyone can I would be interested to hear of them.

--Lars M.