[XML-SIG] SAX Namespaces

Paul Prescod paul@prescod.net
Tue, 04 Jul 2000 08:50:39 -0500


Uche Ogbuji wrote:
> 
> ...
> 
> I'll admit that Paul's point that the API changes least from SAX 1 to SAX 2 in
> option #4 is pretty attractive (I must have missed this point earlier).

I may not have made it. Choosing the best way to handle this was a long
thought process that was invariably muddy because it involved thinking
about elements and attributes in parallel and thinking about various use
cases for attributes. Which brings us back to attributes. These are the
more important detail in terms of performance.

Several people got their hackles up when I started describing what sorts
of applications we should or should not be aiming SAX to. I wasn't
thinking. I shouldn't have sent the conversation in that direction at
all. It's just a distraction. I'll try to rewrite the technical parts.

We know that many people are going to use SAX in many different ways. We
know that a large group is going to use it as a headless driver. Another
group is going to program domain-specific apps (at least at first).
These groups have different needs but they are not THAT different that
they should be competitive.

Right now every driver needs code like this in it:

attrs=MyAttrDataStructure() (perhaps a dict or list)
attrs=AttributeList( attrs )

The generated object is inefficient to loop over and of course the
instance construction has cost. For a lot of apps, you need to copy each
attribute out of the object through a level of method calls.

My proposal is to move that last line from the driver into the
application and let the application do it only if it wants to. That
gives them the choice of the right object wrapper (if any), depending on
whether they want to iterate, or index by rawnames or index by
localname/rawname pairs. Of course we will provide at least one object
wrapper. So to get back the old behavior all you need to do is say:

attrs=AttributeList( attrs ) 

as the first line of your handler. I don't see this as an onerous
requirement making SAX unusable. Rather it makes it more widely usable.

-- 
 Paul Prescod - Not encumbered by corporate consensus
The great era of mathematical physics is now over; the 300-year effort
to
represent the material world in mathematical terms has exhausted itself.
The
understanding it was to provide is infinitely closer than it was when
Isaac
Newton wrote in the late seventeenth centruy, but it is still infinitely
far
away.
	- The Advent of the Algorithm, by David Berlinski