|
4 | 4 |
|
5 | 5 |
|
6 | 6 | def load(filename, backend="xml"):
|
| 7 | + """ |
| 8 | + Load an odML document from file. |
| 9 | + :param filename: Path and filename from where the odML document |
| 10 | + is to be loaded and parsed. |
| 11 | + :param backend: File format of the file containing the odML document. |
| 12 | + The default format is XML. |
| 13 | + :return: The parsed odML document. |
| 14 | + """ |
7 | 15 | reader = ODMLReader(backend)
|
8 | 16 | return reader.from_file(filename)
|
9 | 17 |
|
10 | 18 |
|
11 | 19 | def save(obj, filename, backend="xml"):
|
| 20 | + """ |
| 21 | + Save an open odML document to file of a specified format. |
| 22 | + :param obj: odML document do be saved. |
| 23 | + :param filename: Filename and path where the odML document |
| 24 | + should be saved. |
| 25 | + :param backend: Format in which the odML document is to be saved. |
| 26 | + The default format is XML. |
| 27 | + """ |
12 | 28 | writer = ODMLWriter(backend)
|
13 | 29 | return writer.write_file(obj, filename)
|
14 | 30 |
|
15 | 31 |
|
16 | 32 | def display(obj, backend="xml"):
|
| 33 | + """ |
| 34 | + Print an open odML document to the command line, formatted in the |
| 35 | + specified format. |
| 36 | + :param obj: odML document to be displayed. |
| 37 | + :param backend: Format in which the odML document is to be displayed. |
| 38 | + The default format is XML. |
| 39 | + """ |
17 | 40 | writer = ODMLWriter(backend)
|
18 | 41 | print(writer.to_string(obj))
|
0 commit comments