Skip to content

Commit 5b15a7e

Browse files
authored
Update 2024-12-20-18-54-53.gh-issue-128136.tgbvWt.rst
1 parent 52bc8df commit 5b15a7e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
New parameter added to the write function that allows you to customize the xml declaration, which was previously hard-coded.
2-
32
The standard functionality is retained; if you don't specify the xml_declaration_definition parameter, the previous standard declaration is used. ``<?xml version='1.0' encoding='{encoding}'?>``
4-
53
When specifying the parameter, the following options are available.
64
E.g.:
7-
8-
- tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="{version}" encoding="{encoding}"?>''')
9-
- tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="1.1" encoding="{encoding}"?>''')
10-
- tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="1.1"?>''')
11-
12-
5+
tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="{version}" encoding="{encoding}"?>''')
6+
tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="1.1" encoding="{encoding}"?>''')
7+
tree.write(file, encoding="utf-8", xml_declaration=True, xml_declaration_definition='''<?xml version="1.1"?>''')
138
The placeholders {version} and {encoding} are replaced, version is always 1.0 and enconding depends on the code as before.

0 commit comments

Comments
 (0)