error "not well-formed (invalid token)" while parsing XML file in python using lxml
I am trying to parse XML file using lxml but getting error while parsing. This error is due to arrow sign → in XML. if I remove it, it works fine.
here is the line 51 of that xml where error is coming
a.xml <nature code = "lengthy">entertainment → to the light</nature>
code: import xml.etree.ElementTree as ET tree = ET.parse("a.xml") root = tree.getroot()
The solution I tried But it is still giving me the same issue
parser = ET.XMLParser(encoding="utf-8") tree = ET.parse("test_xml.xml", parser=parser)
Current output is the error:
xml.etree.ElementTree.ParseError: not well-formed (invalid token) in line 51
any help would be appreciated.