Skip to content

Commit 6871c83

Browse files
author
eberhardtj
committed
Add example for a flux use-case
1 parent 57e25eb commit 6871c83

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

example/morph.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<metamorph xmlns="http://www.culturegraph.org/metamorph" version="1">
3+
<rules>
4+
<data name="name" source="name.value"/>
5+
<choose name="lastname">
6+
<data source="lastname.value"/>
7+
<data source="_id"><constant value="NA"/></data>
8+
</choose>
9+
</rules>
10+
</metamorph>

example/process.flux

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FLUX_DIR + "records.xml"
2+
| open-file
3+
| decode-xml
4+
| handle-generic-xml("row")
5+
| morph("morph.xml")
6+
| encode-csv(separator=";", noQuotes="true")
7+
| print;

example/records.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<rows>
3+
<row>
4+
<name>alice</name>
5+
</row>
6+
<row>
7+
<name>bob</name>
8+
</row>
9+
</rows>

0 commit comments

Comments
 (0)