Skip to content

Commit 34ef6cd

Browse files
added changes for xml serialization
1 parent 3c75bd3 commit 34ef6cd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/modelspec/base_types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def to_xml(self) -> str:
122122
"""
123123
from modelspec.utils import build_xml_element
124124

125-
root = ET.Element("modelspec")
126-
build_xml_element(root, self.to_dict())
125+
# root = ET.Element("modelspec")
126+
root = build_xml_element(self)
127127

128128
xml_string = ET.tostring(
129129
root, encoding="utf-8", xml_declaration=False, method="xml"
@@ -273,12 +273,12 @@ def to_xml_file(
273273
if filename is None:
274274
filename = f"{self.id}.xml"
275275

276-
root = ET.Element(root_name)
276+
# root = ET.Element(root_name)
277277

278-
build_xml_element(root, self.to_dict())
278+
root = build_xml_element(self)
279279

280280
# Create an ElementTree object with the root element
281-
tree = ET.ElementTree(root)
281+
# tree = ET.ElementTree(root)
282282

283283
# Generate the XML string
284284
xml_str = ET.tostring(root, encoding="utf-8", method="xml").decode("utf-8")

0 commit comments

Comments
 (0)