-
Notifications
You must be signed in to change notification settings - Fork 0
Basic example
Bart Noordervliet edited this page Jan 25, 2022
·
6 revisions
In this example we'll convert this simple XML document containing information about books. The configuration YAML might look like this:
name: books
file: books.dump
path: /catalog/book
cols:
- name: id
path: ""
attr: id
- name: author
path: /author
- name: title
path: /title
- name: genre
path: /genre
incl: ^(Fantasy|Science Fiction)$
- name: price
path: /price
- name: publish_date
path: /publish_date
- name: description
path: /description
So what we're saying here is that the table is called 'books', we want to write the output to the file 'books.dump'. The repeating XML element is <book> within the root <catalog> element. We take the id number from the 'id' attribute on the <book> element. Because this is the repeating element itself, the path for this column is empty. Then we take the other column values from the other elements within <book>. We put a regex filter on the 'genre' column to include only the Fantasy and Science Fiction genres.