Skip to content

Commit bb485e6

Browse files
authored
Merge pull request #196 from andylolz/146-sort-xml
[COMPLETE] Sort XML according to provided schema(s)
2 parents eac19ad + 9d2775e commit bb485e6

File tree

15 files changed

+3036
-29
lines changed

15 files changed

+3036
-29
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [0.2.0] - 2018-08-13
10+
11+
### Added
12+
13+
- Sort XML according to provided schema(s) https://github.com/OpenDataServices/flatten-tool/pull/196
14+
15+
### Changed
16+
17+
- Remove Python 3.3 support https://github.com/OpenDataServices/flatten-tool/commit/636cf988ff7e5247a089b22061f0fe7767ea81b4
18+
919
### Fixed
1020

1121
- Avoid some openpyxl warnings https://github.com/OpenDataServices/flatten-tool/pull/211

examples/help/unflatten/expected.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ usage: flatten-tool unflatten [-h] -f {csv,xlsx} [--xml] [--id-name ID_NAME]
99
[--metatab-schema METATAB_SCHEMA]
1010
[--metatab-only]
1111
[--metatab-vertical-orientation]
12+
[--xml-schema [XML_SCHEMA [XML_SCHEMA ...]]]
1213
[--default-configuration DEFAULT_CONFIGURATION]
1314
input_name
1415

@@ -61,6 +62,8 @@ optional arguments:
6162
--metatab-vertical-orientation
6263
Read metatab so that headings are in the first column
6364
and data is read vertically. Only for XLSX not CSV
65+
--xml-schema [XML_SCHEMA [XML_SCHEMA ...]]
66+
Path to one or more XML schemas (used for sorting)
6467
--default-configuration DEFAULT_CONFIGURATION
6568
Comma seperated list of default parsing commands for
6669
all sheets. Only for XLSX not CSV

examples/iati/cmd.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$ flatten-tool unflatten --xml --id-name iati-identifier --root-list-path iati-activity -f csv examples/iati
1+
$ flatten-tool unflatten --xml --id-name iati-identifier --root-list-path iati-activity --xml-schema examples/iati/iati-activities-schema.xsd examples/iati/iati-common.xsd -f csv examples/iati

examples/iati/expected.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
<reporting-org ref="AA-AAA-123456789" type="40">
66
<narrative>Organisation name</narrative>
77
</reporting-org>
8-
<participating-org ref="AA-AAA-123456789" role="1"/>
9-
<activity-status code="2"/>
10-
<activity-date iso-date="2011-10-01" type="1"/>
11-
<recipient-country code="AF" percentage="40"/>
12-
<recipient-country code="XK" percentage="60"/>
138
<title>
149
<narrative>A title</narrative>
1510
</title>
1611
<description>
1712
<narrative>A description</narrative>
1813
</description>
14+
<participating-org ref="AA-AAA-123456789" role="1"/>
15+
<activity-status code="2"/>
16+
<activity-date iso-date="2011-10-01" type="1"/>
17+
<recipient-country code="AF" percentage="40"/>
18+
<recipient-country code="XK" percentage="60"/>
1919
<transaction>
2020
<transaction-type code="2"/>
2121
<transaction-date iso-date="2012-01-01"/>
@@ -32,17 +32,17 @@
3232
<reporting-org ref="AA-AAA-123456789" type="40">
3333
<narrative>Organisation name</narrative>
3434
</reporting-org>
35-
<participating-org ref="AA-AAA-123456789" role="1"/>
36-
<activity-status code="3"/>
37-
<activity-date iso-date="2016-01-01" type="2"/>
38-
<recipient-country code="AG" percentage="30"/>
39-
<recipient-country code="XK" percentage="70"/>
4035
<title>
4136
<narrative>Another title</narrative>
4237
</title>
4338
<description>
4439
<narrative>Another description</narrative>
4540
</description>
41+
<participating-org ref="AA-AAA-123456789" role="1"/>
42+
<activity-status code="3"/>
43+
<activity-date iso-date="2016-01-01" type="2"/>
44+
<recipient-country code="AG" percentage="30"/>
45+
<recipient-country code="XK" percentage="70"/>
4646
<transaction>
4747
<transaction-type code="2"/>
4848
<transaction-date iso-date="2013-04-04"/>

0 commit comments

Comments
 (0)