From 3c18996102c71ff91613e6f60f60e4bfa9a55f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=BClte?= Date: Tue, 1 Feb 2022 16:52:22 +0100 Subject: [PATCH] Add example for array to repeated field in xml https://github.com/metafacture/metafacture-fix/issues/106 --- .../testing/repeatedFieldsArrayToXML/expected.xml | 9 +++++++++ .../repeatedFieldsArrayToXML/newRepeatedField.fix | 1 + .../newRepeatedField.flux | 8 ++++++++ data/testing/repeatedFieldsArrayToXML/result.xml | 15 +++++++++++++++ data/testing/repeatedFieldsArrayToXML/test.json | 5 +++++ 5 files changed, 38 insertions(+) create mode 100644 data/testing/repeatedFieldsArrayToXML/expected.xml create mode 100644 data/testing/repeatedFieldsArrayToXML/newRepeatedField.fix create mode 100644 data/testing/repeatedFieldsArrayToXML/newRepeatedField.flux create mode 100644 data/testing/repeatedFieldsArrayToXML/result.xml create mode 100644 data/testing/repeatedFieldsArrayToXML/test.json diff --git a/data/testing/repeatedFieldsArrayToXML/expected.xml b/data/testing/repeatedFieldsArrayToXML/expected.xml new file mode 100644 index 0000000..8bff49e --- /dev/null +++ b/data/testing/repeatedFieldsArrayToXML/expected.xml @@ -0,0 +1,9 @@ + + + + dog + elefant + dog + elefant + + \ No newline at end of file diff --git a/data/testing/repeatedFieldsArrayToXML/newRepeatedField.fix b/data/testing/repeatedFieldsArrayToXML/newRepeatedField.fix new file mode 100644 index 0000000..f7c6f1d --- /dev/null +++ b/data/testing/repeatedFieldsArrayToXML/newRepeatedField.fix @@ -0,0 +1 @@ +copy_field("animals[]", "animals") \ No newline at end of file diff --git a/data/testing/repeatedFieldsArrayToXML/newRepeatedField.flux b/data/testing/repeatedFieldsArrayToXML/newRepeatedField.flux new file mode 100644 index 0000000..9b7246e --- /dev/null +++ b/data/testing/repeatedFieldsArrayToXML/newRepeatedField.flux @@ -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") +; \ No newline at end of file diff --git a/data/testing/repeatedFieldsArrayToXML/result.xml b/data/testing/repeatedFieldsArrayToXML/result.xml new file mode 100644 index 0000000..f87b9e6 --- /dev/null +++ b/data/testing/repeatedFieldsArrayToXML/result.xml @@ -0,0 +1,15 @@ + + + + + + <1>dog + <2>elefant + + + <1>dog + <2>elefant + + + + diff --git a/data/testing/repeatedFieldsArrayToXML/test.json b/data/testing/repeatedFieldsArrayToXML/test.json new file mode 100644 index 0000000..2e390cc --- /dev/null +++ b/data/testing/repeatedFieldsArrayToXML/test.json @@ -0,0 +1,5 @@ +{ + "animals": [ + "dog", "elefant" + ] +} \ No newline at end of file