entities as attribute values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
I'm trying to write an xml file that has entities as values for attributes. If I try to write the entity as text, the & is xml-escaped to &. If I try to call set() with an Entity, I get an error:
>>> import lxml.etree
>>> tree= lxml.etree.
>>> tree.set ('foo', '&bar;')
>>> print lxml.etree.tostring (tree)
<a foo="&bar;"/>
>>> tree.set ('foo', lxml.etree.Entity ('bar'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lxml.etree.pyx", line 695, in lxml.etree.
File "apihelpers.pxi", line 563, in lxml.etree.
File "apihelpers.pxi", line 1367, in lxml.etree._utf8 (src/lxml/
TypeError: Argument must be bytes or unicode, got '_Entity'
Originally reported by Marcos Dione.
Changed in lxml: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |