File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 2
2
from modelspec import field , instance_of , optional
3
3
from modelspec .base_types import Base
4
4
from typing import List
5
+ from modelspec .utils import save_to_xml_file
5
6
6
7
# Example showing how to create a model of a document and use it to create/serialize instances
7
8
@@ -70,10 +71,12 @@ class Document(Base):
70
71
doc .to_json_file ("document.json" )
71
72
doc .to_yaml_file ("document.yaml" )
72
73
doc .to_bson_file ("document.bson" )
74
+ doc .to_xml_file ("document.xml" )
73
75
74
76
print (" >> Full document details in YAML format:\n " )
75
77
76
78
print (doc .to_yaml ())
79
+ print (doc .to_xml ())
77
80
78
81
doc_md = doc .generate_documentation (format = "markdown" )
79
82
@@ -106,3 +109,5 @@ class Document(Base):
106
109
107
110
with open ("document.specification.bson" , "wb" ) as d :
108
111
d .write (bson .encode (doc_dict ))
112
+
113
+ save_to_xml_file (doc_dict ,"document.specification.xml" )
You can’t perform that action at this time.
0 commit comments