[XML-SIG] Issues with XMLTreeBuilder in cElementTree and ElementTree

Stefan Behnel stefan_ml at behnel.de
Tue Mar 25 23:04:37 CET 2008


Hi again,

Michael Becker wrote:
> These changes would allow the user to take advantage of the
> ordered_attributes attribute in the expat parser to use either ordered
> or unorder attributes as desired. For backwards compatibility it might
> be desirable to change XMLTreeBuilder to default to ordered_attributes
> = 0. I've never submitted a bug fix to a python library so if this
> seems like a real bug please let me know how to proceed.
> 
> Secondly, I found a potential issue with the cElementTree module. My
> understanding (which could be incorrect) of python C modules is that
> they should work the same as the python versions but be more
> efficient. The XMLTreeBuilder class in cElementTree doesn't seem to be
> using the same parser as that in ElementTree. The following code
> illustrates this issue:
> 
>>>> import xml.etree.cElementTree
>>>> t1=xml.etree.cElementTree.XMLTreeBuilder()
>>>> t1._parser.ordered_attributes = 1
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: _parser

(c)ET's XMLParser has an attribute "parser" that references the expat parser
instance. It was renamed in newer versions.

Stefan



More information about the XML-SIG mailing list