[XML-SIG] SAX Namespaces
Lars Marius Garshol
larsga@garshol.priv.no
05 Jul 2000 17:52:35 +0200
* Lars Marius Garshol
|
| I would prefer replacing the tuple with the qname. Any code that
| looks at the internal structure of names for (uri, localname) will
| assume namespace processing anyway, methinks. If anyone can think of
| convincing use cases that are made awkward by the string
| representation I will reconsider.
* Greg Stein
|
| As long as you're saying it is ((uri, localname), qname) or (qname,
| qname), then I'm fine with that.
Actually, I was thinking (uri, localname) or qname. (I was talking
about #1., not #2, using Paul's numbers.)
| In either case value[0] is the "name" of the item.
This is a good point. If we go for Paul's #2 we have two choices
(let's call them #2a and #2b):
#2a: namespaces on: startElement(self, ((uri, local), qname), attrs)
namespaces off: startElement(self, (qname, qname), attrs)
#2b: namespaces on: startElement(self, ((uri, local), qname), attrs)
namespaces off: startElement(self, qname, attrs)
#2a is troublesome because it's ugly in non-namespace mode and has the
exact same problem as my #1 in non-namespace mode: it forces namespace
awareness on the poor novice.
#2b is troublesome because it means that you have to act differently
to get the true name depending on whether namespaces are on or off.
To me this makes #2b very close to unacceptable.
#2a seems to me to be inferior to #1 at first glance. The final qname
in the outer tuple seems better off as a separate parameter than stuck
inside that tuple. Of course, this leaves the question of how we
represent attributes. In my opinion we could go for #1 and still use
some variant of Paul's attribute lists. The question is just which
one:
i) [((URI, localname, qname), value), ...]
ii) [(((URI, localname), qname), value), ...]
iii) [((URI, localname), qname, value), ...]
iv) {(URI, localname) : (qname, value), ...}
v) ({(URI, localname) : value, ...}, {qname : (URI, localname), ...})
More ideas? Opinions? Does it really matter what we choose here, if we
are going to have a convenience wrapper class anyway?
--Lars M.