I get TypeError: Type 'NoneType' cannot be serialized.
while reading the following xml file
<root>
<sub_component>
Hii & heloo <>
</sub_component>
</root>
The code I use for coding is as follows
from lxml import etree
parser = etree.XMLParser(recover=True) # recover from bad characters.
root = etree.fromstring(file_path, parser=parser)
print etree.tostring(root)