[1bd6b5]: / helpers / utils.py

Download this file

19 lines (14 with data), 370 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import xmltodict
import json
from xml.etree import ElementTree
from display_xml import XML
def xml_element_to_json(element: ElementTree.Element):
return json.loads(json.dumps(
xmltodict.parse(
ElementTree.tostring(
element
)
)
))
def display_xml(element):
return XML(ElementTree.tostring(element))