Это xml данные и код, которые я пытаюсь преобразовать в json данные:
import xmltodict
import json
xml = '''<?xml version="1.0" encoding="UTF-8" ?>
<XML xmlns:r="#SchemaA2A">
<Schema name="SchemaA2A" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">
<ElementType name="ROOT" content="eltOnly" model="closed" order="many">
<AttributeType name="Response" dt:type="i4"/>
<AttributeType name="ErrorNumber" dt:type="i4"/>
<AttributeType name="ErrorDescription" dt:type="string"/>
<AttributeType name="ErrorDisplay" dt:type="boolean"/>
<attribute type="Response"/>
<attribute type="ErrorNumber"/>
<attribute type="ErrorDescription"/>
<attribute type="ErrorDisplay"/>
</ElementType>
<ElementType name="ROW" content="empty" model="closed">
<AttributeType name="Account #" dt:type="string"/>
<AttributeType name="Tran Date" dt:type="string"/>
<AttributeType name="Post Date" dt:type="string"/>
<AttributeType name="Description" dt:type="string"/>
<AttributeType name="Reference #" dt:type="string"/>
<AttributeType name="Amt" dt:type="string"/>
<attribute type="Account #"/>
<attribute type="Tran Date"/>
<attribute type="Post Date"/>
<attribute type="Description"/>
<attribute type="Reference #"/>
<attribute type="Amt"/>
</ElementType>
</Schema>
<r:ROOT Response="1" ErrorNumber="0" ErrorDescription="" ErrorDisplay="1" >
<r:ROW Account #="xxxxxxxxxx055819" Tran Date="04/09/2020" Post Date="04/09/2020" Description="ValueLoad" Reference #="" Amt="50" />
<r:ROW Account #="xxxxxxxxxx055819" Tran Date="04/22/2020" Post Date="04/22/2020" Description="Balance Adjustment Debit Cardholder" Reference #="" Amt="-10" />
</r:ROOT>
</XML>
'''
mydict=xmltodict.parse(xml, encoding="utf-8")
json_data=json.dumps(mydict)
print(json_data)
Это возвращает ошибку:
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 30, column 15
Какой я Вера указывает на конец
Действительно запутался, почему я получаю эту ошибку. Любая помощь будет оценена.