case sensitivity and XML

Fredrik Lundh effbot at telia.com
Sun May 21 22:30:12 CEST 2000


Michal Wallace (sabren) wrote:
> Not so. In xmllib, you use functions like:
> 
>    start_sometag(self, attrs):
>         pass

checked the library reference lately?  that's not the documented
way of doing things...

(tags can contain colons and dots -- and with namespaces, they
can be complete URI's.  the 1.5.2 alphas didn't even support the
start/end hooks; iirc, I added the compatibility code...)

xmllib already contains functions to map arbitrary tag names to
handlers.  see the library reference for details.

> Suppose you have this: '<sometag a="lowercase" A="uppercase" a-b="a dash b"/>'
> Then, case sensitive python would yield this dictionary:
> 
>    attrs == {"a":"lowercase", "A":"uppercase", "a-b":"a dash b"}
> 
> No problem whatsoever. Case INsensitive python yields the same dictionary,
> but how do you tell "a" apart from "A"? For example, what is the truth
> value of: attrs["a"] == attrs["A"] ?

oh, you're still thinking that case-insensitive identifiers means
that *all* string comparisitions should ignore case?  I'm pretty
sure that wasn't what Guido had in mind...

> One option is to say that python just won't be able to parse some
> XML documents. I think that would be suicide for the language, as
> more and more people and companies start using XML.

well, start/end has never worked for all valid XML documents, so
that's not much of an argument...

</F>




More information about the Python-list mailing list