File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 3
3
import bson
4
4
import xml .etree .ElementTree as ET
5
5
import xml .dom .minidom
6
+ import xmltodict
6
7
import sys
7
8
8
9
import numpy as np
@@ -166,10 +167,10 @@ def from_bson(cls, bson_str: str) -> "Base":
166
167
@classmethod
167
168
def from_xml (cls , xml_str : str ) -> "Base" :
168
169
"""Instantiate a Base object from an XML string"""
169
- from modelspec .utils import _parse_xml_element
170
+ from modelspec .utils import element_to_dict
170
171
171
172
root = ET .fromstring (xml_str )
172
- data_dict = _parse_xml_element (root )
173
+ data_dict = element_to_dict (root )
173
174
return cls .from_dict (data_dict )
174
175
175
176
def to_json_file (
@@ -400,13 +401,13 @@ def from_xml_file(cls, filename: str) -> "Base":
400
401
Returns:
401
402
A modelspec Base for this XML.
402
403
"""
403
- from modelspec .utils import _parse_xml_element
404
+ from modelspec .utils import element_to_dict
404
405
405
406
with open (filename ) as infile :
406
407
tree = ET .parse (filename )
407
408
root = tree .getroot ()
408
409
409
- data_dict = _parse_xml_element (root )
410
+ data_dict = element_to_dict (root )
410
411
return cls .from_dict (data_dict )
411
412
412
413
def get_child (self , id : str , type_ : str ) -> Any :
You can’t perform that action at this time.
0 commit comments