Skip to content

Commit 5d5de72

Browse files
committed
[tools/xmlparser] Add XMLWriter docstring
1 parent 111e6c5 commit 5d5de72

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

odml/tools/xmlparser.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,25 @@ def __str__(self):
130130
def __unicode__(self):
131131
return ET.tounicode(self.save_element(self.doc), pretty_print=True)
132132

133-
def write_file(self, filename, local_style=False, custom_template=False):
134-
# calculate the data before opening the file in case we get any
135-
# exception
133+
def write_file(self, filename, local_style=False, custom_template=None):
134+
"""
135+
write_file saves the XMLWriters odML document to an XML file.
136+
:param filename: location and name where the file will be written to.
137+
:param local_style: Optional boolean. By default an odML XML document is saved
138+
with a default header containing an external stylesheet for
139+
viewing with a local or remote server. Set up for local
140+
viewing with the 'odmlview' command line script.
141+
When set to True, the saved XML file will contain a default
142+
XSL stylesheet to render the XML file in a web-browser.
143+
Note that Chrome requires the '.odml' extension to be
144+
registered as "application/xml" in the Mime-type database.
145+
:param custom_template: Optional string. Provide a custom XSL template to render
146+
the odML XML file in a web-browser.
147+
Please note, that the custom XSL template must not be a
148+
full XSL stylesheet, but has to start and end with the
149+
tag: '<xsl:template match="odML">[custom]</xsl:template>'.
150+
"""
151+
# calculate the data before opening the file in case we get any exception
136152
if sys.version_info < (3,):
137153
data = unicode(self).encode('utf-8')
138154
else:

0 commit comments

Comments
 (0)