Skip to content

Commit 23dcdb4

Browse files
committed
Rename xml_root_path to xml_root_tag
1 parent 3aaf3f0 commit 23dcdb4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

flattentool/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ def unflatten(input_name, base_json=None, input_format=None, output_name=None,
208208
base[root_list_path] = list(result)
209209

210210
if xml:
211-
xml_root_path = base_configuration.get('XMLRootPath', 'iati-activities')
211+
xml_root_tag = base_configuration.get('XMLRootTag', 'iati-activities')
212212
if output_name is None:
213213
if sys.version > '3':
214-
sys.stdout.buffer.write(toxml(base, xml_root_path))
214+
sys.stdout.buffer.write(toxml(base, xml_root_tag))
215215
else:
216-
sys.stdout.write(toxml(base, xml_root_path))
216+
sys.stdout.write(toxml(base, xml_root_tag))
217217
else:
218218
with codecs.open(output_name, 'wb') as fp:
219-
fp.write(toxml(base, xml_root_path))
219+
fp.write(toxml(base, xml_root_tag))
220220
else:
221221
if output_name is None:
222222
print(json.dumps(base, indent=4, default=decimal_default, ensure_ascii=False))

flattentool/lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ def parse_sheet_configuration(configuration_list):
1717
configuration['ignore'] = True
1818
if (len(parts) == 1 and parts[0].lower() in ("hashcomments", "hashcomment")):
1919
configuration['hashcomments'] = True
20-
if (len(parts) == 2 and parts[0].lower() == "xmlrootpath"):
21-
configuration['XMLRootPath'] = parts[1]
20+
if (len(parts) == 2 and parts[0].lower() == "xmlroottag"):
21+
configuration['XMLRootTag'] = parts[1]
2222
return configuration

flattentool/xml_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def dict_to_xml(data, tagname, toplevel=True, nsmap=None):
5454
return el
5555

5656

57-
def toxml(data, xml_root_path):
57+
def toxml(data, xml_root_tag):
5858
nsmap = {
5959
# This is "bound by definition" - see https://www.w3.org/XML/1998/namespace
6060
'xml': 'http://www.w3.org/XML/1998/namespace'
6161
}
62-
root = dict_to_xml(data, xml_root_path, nsmap=nsmap)
62+
root = dict_to_xml(data, xml_root_tag, nsmap=nsmap)
6363
comment = ET.Comment('XML generated by flatten-tool')
6464
root.insert(0, comment)
6565
return ET.tostring(root)

0 commit comments

Comments
 (0)