<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question NiFi: Extract atrribute value from XML using EvaluateXPath in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-Extract-atrribute-value-from-XML-using-EvaluateXPath/m-p/180270#M142516</link>
    <description>&lt;P&gt;I created a workflow in NiFi 1.5.0 that reads a XML file from HDFS. After splitting the file into separate &amp;lt;Transaction&amp;gt; elements, I want to read out an attribute's value and afterwards react by this value.&lt;/P&gt;&lt;P&gt;My original XML looks like this:&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;Log&amp;gt;
  &amp;lt;Transaction Type="1" TrainingModeFlag="true"&amp;gt;
    &amp;lt;StoreID&amp;gt;240041&amp;lt;/StoreID&amp;gt;
     ...
  &amp;lt;/Transaction&amp;gt;
&amp;lt;/Log&amp;gt;&lt;/PRE&gt;&lt;P&gt;My Workflow splits the XML via SplitXML in depth 1, so after this processor I have this sub-xml:&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;Transaction Type="1" TrainingModeFlag="true"&amp;gt;
  &amp;lt;StoreID&amp;gt;240041&amp;lt;/StoreID&amp;gt;
   ...
&amp;lt;/Transaction&amp;gt;&lt;/PRE&gt;&lt;P&gt;I want to extract the value of the &lt;STRONG&gt;Type &lt;/STRONG&gt;attribute of the &lt;STRONG&gt;Transaction &lt;/STRONG&gt;tag, but it doesn't work for me. Here my &lt;STRONG&gt;EvaluateXPath &lt;/STRONG&gt;processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72493-1.png" style="width: 799px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19313iA8A6A4E9552640A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72493-1.png" alt="72493-1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My new content attribute has an empty string set, instead of showing the value &lt;STRONG&gt;1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="72494-2.png" style="width: 1867px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19314iF6EFA58A48B15F14/image-size/medium?v=v2&amp;amp;px=400" role="button" title="72494-2.png" alt="72494-2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;Using the XPath &lt;STRONG&gt;//@Type&lt;/STRONG&gt; works, but I need the exact path, as the &lt;STRONG&gt;Type &lt;/STRONG&gt;attribute can occur in sub-elements.&lt;/P&gt;&lt;P&gt;Can someone help?&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 09:12:20 GMT</pubDate>
    <dc:creator>dmueller1607</dc:creator>
    <dc:date>2019-08-18T09:12:20Z</dc:date>
  </channel>
</rss>

