<?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 Using EvaluateXpath prossessor in nifi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Using-EvaluateXpath-prossessor-in-nifi/m-p/232718#M67140</link>
    <description>&lt;P&gt;I have response like this and i want to extract ErrorCode value from response flowfile anc check if it is equal to -7 and if it is, I will have to log this. I tried this in EvaluateXpath processor:/Error/ErrorCode/text() but it doesn't work for me after passing EvaluateXpath processor  flowfile attribute errorCode  which i  have added  with  above mentioned command(/Error/ErrorCode/text()) seems  to be  emty string set  &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;what should i change to get value  of ErrorCode in errorcode atribute?&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&amp;lt;Result xmlns="olineservice" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;
&amp;lt;ResponseStatus&amp;gt;false&amp;lt;/ResponseStatus&amp;gt;
&amp;lt;Error&amp;gt;
&amp;lt;ErrorCode&amp;gt;-7&amp;lt;/ErrorCode&amp;gt;
&amp;lt;ErrorDescription&amp;gt;data  wasn't  found&amp;lt;/ErrorDescription&amp;gt;
&amp;lt;/Error&amp;gt;
&amp;lt;/Result&amp;gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Aug 2017 00:44:36 GMT</pubDate>
    <dc:creator>salome_tkhilais</dc:creator>
    <dc:date>2017-08-24T00:44:36Z</dc:date>
    <item>
      <title>Using EvaluateXpath prossessor in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Using-EvaluateXpath-prossessor-in-nifi/m-p/232718#M67140</link>
      <description>&lt;P&gt;I have response like this and i want to extract ErrorCode value from response flowfile anc check if it is equal to -7 and if it is, I will have to log this. I tried this in EvaluateXpath processor:/Error/ErrorCode/text() but it doesn't work for me after passing EvaluateXpath processor  flowfile attribute errorCode  which i  have added  with  above mentioned command(/Error/ErrorCode/text()) seems  to be  emty string set  &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;what should i change to get value  of ErrorCode in errorcode atribute?&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&amp;lt;Result xmlns="olineservice" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;
&amp;lt;ResponseStatus&amp;gt;false&amp;lt;/ResponseStatus&amp;gt;
&amp;lt;Error&amp;gt;
&amp;lt;ErrorCode&amp;gt;-7&amp;lt;/ErrorCode&amp;gt;
&amp;lt;ErrorDescription&amp;gt;data  wasn't  found&amp;lt;/ErrorDescription&amp;gt;
&amp;lt;/Error&amp;gt;
&amp;lt;/Result&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Aug 2017 00:44:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Using-EvaluateXpath-prossessor-in-nifi/m-p/232718#M67140</guid>
      <dc:creator>salome_tkhilais</dc:creator>
      <dc:date>2017-08-24T00:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using EvaluateXpath prossessor in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Using-EvaluateXpath-prossessor-in-nifi/m-p/232719#M67141</link>
      <description>&lt;P&gt;
	From 
	&lt;A target="_blank" href="https://stackoverflow.com/a/45847932/70465"&gt;my answer to this question on Stack Overflow&lt;/A&gt;:
&lt;/P&gt;
&lt;P&gt;
	To extract the desired value, use the XPath expression 
	&lt;CODE&gt;//ErrorCode&lt;/CODE&gt;. This will return a &lt;CODE&gt;String&lt;/CODE&gt; value &lt;STRONG&gt;-7&lt;/STRONG&gt;. By selecting &lt;CODE&gt;Destination&lt;/CODE&gt; &lt;STRONG&gt;flowfile-attribute&lt;/STRONG&gt;, you can keep the flowfile content constant and put this new value in a flowfile attribute (i.e. named &lt;CODE&gt;attribute&lt;/CODE&gt;).
&lt;/P&gt;
&lt;P&gt;
	You can chain the &lt;CODE&gt;matched&lt;/CODE&gt; relationship to an &lt;CODE&gt;UpdateAttribute&lt;/CODE&gt; processor which has the expression &lt;CODE&gt;${attribute:toNumber()}&lt;/CODE&gt; to convert it to a numerical representation, i.e. &lt;CODE&gt;${attribute:toNumber():plus(10)}&lt;/CODE&gt; would return &lt;STRONG&gt;3&lt;/STRONG&gt;.
&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 02:45:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Using-EvaluateXpath-prossessor-in-nifi/m-p/232719#M67141</guid>
      <dc:creator>alopresto</dc:creator>
      <dc:date>2017-08-24T02:45:57Z</dc:date>
    </item>
  </channel>
</rss>

