Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Get multiple values from multiple roots from XML in NiFi

Get multiple values from multiple roots from XML in NiFi

New Contributor

I have a XML file as follows:

<Transaction>
<OrganizationID>AmericanEagle</OrganizationID>
<RetailStoreID>11</RetailStoreID>
<WorkstationID>1</WorkstationID>

<RetailTransaction>
<LineItem>
<SequenceNumber>8</SequenceNumber>
<Sale>
<Description>3 4 SLV TOP SOLID</Description>
<ActualSalesUnitPrice>30</ActualSalesUnitPrice>
<ExtendedAmount>90</ExtendedAmount>
<Quantity>3</Quantity>
</Sale>

</LineItem>

<LineItem>
<SequenceNumber>9</SequenceNumber>
<Sale>
<Description>3 4 SLV TOP SOLID</Description>
<ActualSalesUnitPrice>40</ActualSalesUnitPrice>
<ExtendedAmount>120</ExtendedAmount>
<Quantity>3</Quantity>
</Sale>

</LineItem>

</RetailTransaction>

</Transaction>


I want to extract attributes RetailStoreId and ExtendedAmount as in seperate flowfiles in NiFi such that RetailStoreId will be common in both flowfiles and ExtendedAmount will vary.

1. RetailStoreId : 11

ExtendedAmount: 90

2. RetailStoreId: 11

ExtendedAmount: 120


EvaluateXpath processor is able extract only first occurrence of ExtendedAmount.

SplitXML processor can split at one level only. That is, I can get either RetailStoreId or ExtendedAmount. I am unable to find any way to merge these two outputs.


1 REPLY 1

Re: Get multiple values from multiple roots from XML in NiFi

Super Guru
Don't have an account?
Coming from Hortonworks? Activate your account here