[XML-SIG] SAX 2.0 resolution?

Lars Marius Garshol larsga@garshol.priv.no
30 Jul 2000 17:38:31 +0200


This is my proposal for the solution of the namespace-related SAX 2.0
design problems.


The startElement and endElement methods are split into
startElement(name, attrs) / startElementNS(name, qname, attrs) and 
endElement(name, attrs) / endElementNS(name, qname, attrs). 

I feel that this solution is better than the two alternatives, because
it avoids dummy arguments, weird argument encoding and also because it
makes the dual mode operation of SAX clearer than do the alternatives.
Another benefit is that it is consistent with the DOM and it also
seems easier to explain to people.

The only disadvantages I see are that this may cost an extra method
call per callback for some generic filters and that it does not make
it clear that it is not allowed to mix the namespace and non-namespace
methods in a single document.


The Attributes object is retained, but extended with a new method
getNamespaceItems() that returns a ((uri, lname), (qname, value))
list. This should solve the efficiency problems for the DOM
implementations and at the same time provide us with the greatest
implementation flexibility. It also makes it much less awkward to
provide support for type information for attributes and makes it
easier to extend this interface later.

Note that drivers are allowed to recycle Attributes instances between
method calls. 


As for the qname / prefix discussion I have no more of a standpoint in
this debate than I did before. Prefixes seemed to be the most popular
alternative when we last discussed this, but I have since noted that
both the minidom and the 4DOM DOM builders use DOM methods to build
DOM trees, and the DOM wants qname arguments. This seems to me to
indicate that we should go for qnames.

If anyone still has opinions on both the qname/prefix issue and the
other two issues I would like to hear those. Once this has been sorted
out I will start work on SAX 2.0 again.

--Lars M.