Here is sample xml file very simple:
<?xml version="1.0" encoding="UTF-8"?>
<bookstore><book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
<text>There are several harry potter books: -Chamber of Secrets -Goblet of Fire -</text>
</book>
</bookstore>
Using NiFi, I would like to
- rename the text field to
books - Then create a sub-field
book-itemswith Chamber of Secrets as one element and Goblet of Fire another element
I am using EvaluateXpath processor to extract the values. I am not sure how to extract out the text field as separate objects
You will probably want to use the Apache NiFi RecordPath DSL to manipulate structured data in this way.
RecordPathallows you to retrieve, modify, and update fields using a generalized syntax similar to (but not equal to) XPath which applies across all of the various data formats NiFi can interpret as a record (CSV, XML, JSON, Avro, etc.).