How to use xmltodict.parse with non-printable data

121 Views Asked by At

I tried to convert xml to dict with Python

import xmltodict
xmltodict.parse('<a>as\x08</a>')

But I got an exception

ExpatError                                Traceback (most recent call last)
<ipython-input-8-XXXXXX> in <module>
----> 1 xmltodict.parse('<a>as\x08</a>')

~\AppData\Local\Programs\Python\Python37\lib\site-packages\xmltodict.py in parse(xml_input, encoding, expat, process_namespaces, namespace_separator, disable_entities, process_comments, **kwargs)
    376         parser.Parse(b'',True)
    377     else:
--> 378         parser.Parse(xml_input, True)
    379     return handler.item
    380

ExpatError: not well-formed (invalid token): line 1, column 5

How can I use xmltodict library with non-printable char

0

There are 0 best solutions below