Skip to content

Commit c2e6d21

Browse files
modified the from_xml and from_xml_file functions to accomodate the new change
1 parent ff4f37b commit c2e6d21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/modelspec/base_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def from_xml(cls, xml_str: str) -> "Base":
170170
from modelspec.utils import element_to_dict
171171

172172
root = ET.fromstring(xml_str)
173-
data_dict = element_to_dict(root)
173+
data_dict = {root.tag: element_to_dict(root)}
174174
return cls.from_dict(data_dict)
175175

176176
def to_json_file(
@@ -383,7 +383,7 @@ def from_xml_file(cls, filename: str) -> "Base":
383383
tree = ET.parse(filename)
384384
root = tree.getroot()
385385

386-
data_dict = element_to_dict(root)
386+
data_dict = {root.tag: element_to_dict(root)}
387387
return cls.from_dict(data_dict)
388388

389389
def get_child(self, id: str, type_: str) -> Any:

0 commit comments

Comments
 (0)