How to prevent lxml prom compacting elements?

Posted by Almad on Stack Overflow See other posts from Stack Overflow or by Almad
Published on 2010-05-27T13:06:38Z Indexed on 2010/05/27 14:11 UTC
Read the original article Hit count: 227

Filed under:
|
|
|
|

Having following Python code:

>>> from lxml import etree
>>> root = etree.XML("<a><b></b></a>")
>>> etree.tostring(root)
'<a><b/></a>'

How can I force lxml to use "long" version?

Like

>>> etree.tostring(root)
'<a><b></b></a>'

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml