Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Add example for array to repeated field in xml
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Feb 1, 2022
1 parent dfe0804 commit 3c18996
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
9 changes: 9 additions & 0 deletions data/testing/repeatedFieldsArrayToXML/expected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record>
<animals[]>dog</animals[]>
<animals[]>elefant</animals[]>
<animals>dog</animals>
<animals>elefant</animals>
</record>
</records>
1 change: 1 addition & 0 deletions data/testing/repeatedFieldsArrayToXML/newRepeatedField.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("animals[]", "animals")
8 changes: 8 additions & 0 deletions data/testing/repeatedFieldsArrayToXML/newRepeatedField.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "test.json"
|open-file
| as-records
| decode-json
|fix( FLUX_DIR + "newRepeatedField.fix" )
| encode-xml
| write(FLUX_DIR + "result.xml")
;
15 changes: 15 additions & 0 deletions data/testing/repeatedFieldsArrayToXML/result.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<records>

<record>
<animals[]>
<1>dog</1>
<2>elefant</2>
</animals[]>
<animals>
<1>dog</1>
<2>elefant</2>
</animals>
</record>

</records>
5 changes: 5 additions & 0 deletions data/testing/repeatedFieldsArrayToXML/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animals": [
"dog", "elefant"
]
}

0 comments on commit 3c18996

Please sign in to comment.