[XML-SIG] SAX Namespaces
Paul Prescod
paul@prescod.net
Thu, 06 Jul 2000 20:56:23 -0500
"Fred L. Drake, Jr." wrote:
>
> ...
>
> When iterating over these unknown attributes, do you care that you
> see them in their original order? If so, then a sequence is
> *required*, and anything else can be derived (somewhat annoying but
> possible). If you don't care about the *original* order, .items() on
> a mapping is sufficient.
Original order is not a requirement. If it happens to work, it would be
a pleasent side effect.
My main deal is that I see most of my code converting PyExpat's list to
a dictionary (for SAX) and then converting the dictionary back to a list
(for iterating) and then (maybe) converting the list back to a pair of
dictionaries or a dictionary with different index and values.
list->dict->list->(dict,dict)
I proposed to reduce it to:
list->list->(dict,dict)
You proposed to make it
list->FredsDataStructure
which I would use directly.
> I think there are a couple of issues: is it reasonable to require
> the original order of atttributes, and, if not, what's the right
> dictionary key?
No, that's not a requirement.
> (I'd say (URI,localname) in namespace mode, or
> rawname otherwise, with all other information available in the value.)
So is value always a tuple? Always the same size? Or is sometimes a
string and sometimes a tuple?
> xml.sax.AttributeList can provide all the appropriate query methods
> according to the SAX spec at that point
Above you seem to talk about Python's built-in dictionary type. Here you
seem to be talking about a new type or class.
--
Paul Prescod - Not encumbered by corporate consensus
Pop stars come and pop stars go, but amid all this change there is one
eternal truth: Whenever Bob Dylan writes a song about a guy, the guy is
guilty as sin.
- http://www.nj.com/page1/ledger/e2efc7.html