File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
- <iati-activities><iati-activity><iati-identifier>AA-AAA-123456789-ABC123</iati-identifier><reporting-org ref="AA-AAA-123456789" type="40"><narrative>Organisation name</narrative></reporting-org><participating-org ref="AA-AAA-123456789" role="1" /><activity-status code="2" /><activity-date iso-date="2011-10-01" type="1" /><recipient-country code="AF" percentage="40" /><recipient-country code="XK" percentage="60" /><title><narrative>A title</narrative></title><description><narrative>A description</narrative></description><transaction><transaction-type code="2" /><transaction-date iso-date="2012-01-01" /><value value-date="2012-01-01">10</value></transaction><transaction><transaction-type code="3" /><transaction-date iso-date="2012-03-03" /><value value-date="2012-03-03">20</value></transaction></iati-activity><iati-activity><iati-identifier>AA-AAA-123456789-ABC124</iati-identifier><reporting-org ref="AA-AAA-123456789" type="40"><narrative>Organisation name</narrative></reporting-org><participating-org ref="AA-AAA-123456789" role="1" /><activity-status code="3" /><activity-date iso-date="2016-01-01" type="2" /><recipient-country code="AG" percentage="30" /><recipient-country code="XK" percentage="70" /><title><narrative>Another title</narrative></title><description><narrative>Another description</narrative></description><transaction><transaction-type code="2" /><transaction-date iso-date="2013-04-04" /><value value-date="2013-04-04">30</value></transaction><transaction><transaction-type code="3" /><transaction-date iso-date="2013-05-05" /><value value-date="2013-05-05">40</value></transaction></iati-activity></iati-activities>
1
+ <iati-activities><!--XML generated by flatten-tool--><iati-activity><iati-identifier>AA-AAA-123456789-ABC123</iati-identifier><reporting-org ref="AA-AAA-123456789" type="40"><narrative>Organisation name</narrative></reporting-org><participating-org ref="AA-AAA-123456789" role="1" /><activity-status code="2" /><activity-date iso-date="2011-10-01" type="1" /><recipient-country code="AF" percentage="40" /><recipient-country code="XK" percentage="60" /><title><narrative>A title</narrative></title><description><narrative>A description</narrative></description><transaction><transaction-type code="2" /><transaction-date iso-date="2012-01-01" /><value value-date="2012-01-01">10</value></transaction><transaction><transaction-type code="3" /><transaction-date iso-date="2012-03-03" /><value value-date="2012-03-03">20</value></transaction></iati-activity><iati-activity><iati-identifier>AA-AAA-123456789-ABC124</iati-identifier><reporting-org ref="AA-AAA-123456789" type="40"><narrative>Organisation name</narrative></reporting-org><participating-org ref="AA-AAA-123456789" role="1" /><activity-status code="3" /><activity-date iso-date="2016-01-01" type="2" /><recipient-country code="AG" percentage="30" /><recipient-country code="XK" percentage="70" /><title><narrative>Another title</narrative></title><description><narrative>Another description</narrative></description><transaction><transaction-type code="2" /><transaction-date iso-date="2013-04-04" /><value value-date="2013-04-04">30</value></transaction><transaction><transaction-type code="3" /><transaction-date iso-date="2013-05-05" /><value value-date="2013-05-05">40</value></transaction></iati-activity></iati-activities>
Original file line number Diff line number Diff line change @@ -59,4 +59,7 @@ def toxml(data):
59
59
# This is "bound by definition" - see https://www.w3.org/XML/1998/namespace
60
60
'xml' : 'http://www.w3.org/XML/1998/namespace'
61
61
}
62
- return ET .tostring (dict_to_xml (data , 'iati-activities' , nsmap = nsmap ))
62
+ root = dict_to_xml (data , 'iati-activities' , nsmap = nsmap )
63
+ comment = ET .Comment ('XML generated by flatten-tool' )
64
+ root .insert (0 , comment )
65
+ return ET .tostring (root )
You can’t perform that action at this time.
0 commit comments