Answers for "xml.parsers.expat.expaterror: not well-formed (invalid token): line 1, column 0"

0

xml.parsers.expat.expaterror: not well-formed (invalid token): line 1, column 0

import xml.etree.ElementTree as ET
import xmltodict
import json


tree = ET.parse('your_data.xml')
xml_data = tree.getroot()
#here you can change the encoding type to be able to set it to the one you need
xmlstr = ET.tostring(xml_data, encoding='utf-8', method='xml')

data_dict = dict(xmltodict.parse(xmlstr))
Posted by: Guest on March-03-2021

Code answers related to "xml.parsers.expat.expaterror: not well-formed (invalid token): line 1, column 0"

Browse Popular Code Answers by Language