lxml/lxml — pull request #106 by zzzeek (2013-03-29 23:13:04+00:00)
Title: repair attribute mis-interpretation in ElementTreeContentHandler

regarding https://bugs.launchpad.net/lxml/+bug/1136509, this is a proposed fix for the issue.

The first part of the fix just rewrites the attributes in startElement to have keys of the form (namespace, key).

At first, i set namespace to None, but I had a problem with that. It appears that even namespaced attributes like the "xmlns:xsi" in my test document, is also passed to startElement, I suppose because the owning tag doesn't have a namespace. So in this case I'm splitting on the colon and passing in the two tokens to startElementNS, but I'm not sure if this approach is correct. In any case, I added two tests, if you can show what should happen in the tests at least that would make the correct behavior apparent here.