After symbol '\n' pretty_print is ignored. For example:
import lxml.etree as etree
strs = ["<root>\n<e1/><e2/></root>",
"<root><e1/><e2/></root>"]
for str in strs:
xml = etree.fromstring(str)
print etree.tostring(xml, pretty_print=True)
Output is:
<root>
<e1/><e2/></root>
<root>
<e1/>
<e2/>
</root>
Both strings are valid xml. The first string has symbol '\n' and pretty_print is ignored after this symbol.
Is it and lxml bug or do I need special operations for pretty formatting?