[XML-SIG] SAX 2.0 names

THOMAS PASSIN tpassin@idsonline.com
Wed, 1 Mar 2000 08:33:47 -0500


----- Original Message -----
From: Greg Stein <gstein@lyra.org>
To: <xml-sig@python.org>
Sent: Wednesday, March 01, 2000 5:18 AM
Subject: Re: [XML-SIG] SAX 2.0 names


> On 1 Mar 2000, Lars Marius Garshol wrote:
> > * THOMAS PASSIN
> > |
> > | This sounds much like my original proposal for a nested
> > | tuple. Perhaps ((localname,uri),prefix).  Lars pointed out that the
> > | java SAX2 people seem to want the raw name - I'm not convinced since
> > | you need the namespace to confirm what the localname is supposed to
> > | mean, not the rawname.  Comparisons are very easy.
> >
> > Not easy enough, I think.  With a pair or an object you can do
> >
> >   name1 == name2
> >
> > but with nested tuples it becomes
> >
> >   name1[0] == name2[0]
> >
> > which is both slower and more awkward.
Yes, but maybe it's slower bit only in the "noise" range. If so, not to
worry. Yes, it's a little awkward, but somehow you have to 1) keep the
prefix (or rawname), and 2) make comparisons using the uri,not the prefix.
Of course, with the object approach I guess you could overload the
comparison test, maybe that would be better.

>> So I don't like this solution,
> > mainly because it's more awkward, and also because it bugs me that
> > names, in this representation, cannot be compared with == directly.
>
> Dunno where the nested tuple idea comes from, but... bleck.
>
> Just use (localname, uri, prefix). Why make it more difficult?
>
Because you can compare (uri1,localname1)==(uri2,localname2) even if a
different prefix were in use for the same namespace.  This is because
namespace equality depends on the uri, not the exact value of the prefix.