Is there a way to read XML from a string with lxml
, without converting escaped characters ('
for '
, "
for "
, etc) back to their original form?
For example,
from lxml import etree
def test_etree_parse():
test_str = "Text's escaped"
xml = etree.XML(f"<root>{test_str}</root>")
assert xml.find(".").text == test_str
This fails because etree.XML
converts "Text's escaped"
to "Text's escaped"
.