<?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 Re: EvaluateXPath can't return multiple node values in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212220#M69630</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/97208/nagamalleswarij.html" nodeid="97208"&gt;@satyadevi jagata&lt;/A&gt;&lt;P&gt;change the below property value in EvaluateXQuery processor to &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Destination
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;flowfile-attribute&lt;/PRE&gt;&lt;P&gt;Then try to re run the processor.&lt;/P&gt;&lt;P&gt;If the above property value set to &lt;STRONG&gt;flowfile-content&lt;/STRONG&gt; then Processor &lt;STRONG&gt;doesn't allow more than one query to be added&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;If the issue still doesn't resolved, please open a new question for more visibility to the community and &lt;/P&gt;&lt;P&gt;Add all the details what you have tried so far and sample data to reproduce the same issue.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Sep 2018 06:36:06 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2018-09-21T06:36:06Z</dc:date>
    <item>
      <title>EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212214#M69624</link>
      <description>&lt;P style="margin-left: 80px;"&gt;I am trying to parse an xml to extract the header row  (exactly one row at the top of the tsv file) and data rows and write it as single text file in tsv format. But i was unable to extract 2 different NODE types(COLUMNS and DATA) and also multiple DATA elements can be present in the xml). sample xml file. If Destination is "flowfile-content" i can't add two different node types (COLUMNS and DATA) and also can't get multiple &amp;lt;DATA&amp;gt; nodes. Please suggest how i can grab the Columns and DATA and write to a Tab Separated Value file.&lt;BR /&gt;&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;COMPS ReplyCode="0" ReplyText="Operation Successful"&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;COUNT Records="258"/&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;DELIMITER value="09"/&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;COLUMNS&amp;gt;Column1Column2Column3Column4Column5 &amp;lt;/COLUMNS&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;DATA&amp;gt;value11 value12 value13 value14 value15&amp;lt;/DATA&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;DATA&amp;gt;value21 value22 value23 value24 value25&amp;lt;/DATA&amp;gt; &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&amp;lt;/COMPS&amp;gt;&lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/39791-screen-shot-2017-10-12-at-51939-pm.png"&gt;screen-shot-2017-10-12-at-51939-pm.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 22:41:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212214#M69624</guid>
      <dc:creator>cpreddy74</dc:creator>
      <dc:date>2017-10-13T22:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212215#M69625</link>
      <description>&lt;P&gt;error message:&lt;BR /&gt;&lt;BR /&gt;18:26:39 UTC
ERROR
16fb46ea-015f-1000-0000-00007c5fd65b
172.31.192.18:8080&lt;/P&gt;&lt;P&gt;EvaluateXPath[id=16fb46ea-015f-1000-0000-00007c5fd65b] Routing StandardFlowFileRecord[uuid=b941988f-f925-4ec2-a3e5-2830e47cbe8b,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1507917338870-99, container=default, section=99], offset=204551, length=204551],offset=0,name=listings.xml,size=204551] to 'failure' because the XPath evaluated to 257 XML nodes&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 01:36:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212215#M69625</guid>
      <dc:creator>cpreddy74</dc:creator>
      <dc:date>2017-10-14T01:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212216#M69626</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/44410/cpreddy74.html" nodeid="44410" target="_blank"&gt;@Putta Challa&lt;/A&gt;&lt;P&gt;Can you once try using EvaluateXQuery processor&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Destionation&lt;/STRONG&gt; as &lt;STRONG&gt;flowfile-attribute&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;add the below properties:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data &lt;/P&gt;&lt;PRE&gt;//DATA&lt;/PRE&gt;&lt;P&gt;extracts all the data node and keep them as attributes to the flow file.&lt;/P&gt;&lt;P&gt;columns&lt;/P&gt;&lt;PRE&gt;//COLUMNS&lt;/PRE&gt;&lt;P&gt;extracts all the columns node and keep them as attributes to the flowfile.&lt;/P&gt;&lt;P&gt;all_data&lt;/P&gt;&lt;PRE&gt;string-join((for $x in //DATA return $x/text()), '09')&lt;/PRE&gt;&lt;P&gt;gets all the data node and seperate them with 09&lt;/P&gt;&lt;P&gt;columns_data&lt;/P&gt;&lt;PRE&gt;string-join((for $y in (for $x in /COMPS return string-join(($x/DATA/text() , $x/COLUMNS/text()), '09')) return $y), '09')&lt;/PRE&gt;&lt;P&gt;it joins data and columns node values into one and keep this columns_data as attribute.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40843-xquery.png" style="width: 1000px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16592iD0ADC908B98DB1A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40843-xquery.png" alt="40843-xquery.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;then use replace text processor to create new flow file.&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;U&gt;Replacetext configs:-&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;change &lt;STRONG&gt;Replacement Value&lt;/STRONG&gt; to&lt;/P&gt;&lt;PRE&gt;${data.1} //we are having 2 data nodes here we are using data.1 attribute value
${data.2} //data.2 attribute value
${columns} //columns node value
${all_data} //it includes all the data values with 09 separator.
${columns_data} //it includes all the data,columns values with 09 separator.&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40844-replace-text.png" style="width: 616px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16593iC71ECC5C83004C8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40844-replace-text.png" alt="40844-replace-text.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Output:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;value11 value12 value13 value14 value15 
value21 value22 value23 value24 value25
Column1Column2Column3Column4Column5 
value11 value12 value13 value14 value1509value21 value22 value23 value24 value25
value11 value12 value13 value14 value1509value21 value22 value23 value24 value2509Column1Column2Column3Column4Column5 &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Sample Flow:-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40845-flow-xml.png" style="width: 1153px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16594i8267F1935C150F95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40845-flow-xml.png" alt="40845-flow-xml.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Method2:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If you are thinking to just write COLUMNS and DATA to new file that would be easy we can achieve that result by using &lt;STRONG&gt;Replace Text Processor&lt;/STRONG&gt; with these properties&lt;/P&gt;&lt;P&gt;Change &lt;STRONG&gt;Search Value&lt;/STRONG&gt; to &lt;/P&gt;&lt;PRE&gt;[\s\S]{1,}&amp;lt;COLUMNS&amp;gt;(.*)&amp;lt;\/COLUMNS&amp;gt;[\r\n]+&amp;lt;DATA&amp;gt;(.*)&amp;lt;\/DATA&amp;gt;[\r\n]+&amp;lt;DATA&amp;gt;(.*)&amp;lt;\/DATA&amp;gt;[\s\S]{1,}&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;ReplaceText Search Value Config:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40841-searchvalue-prop.png" style="width: 774px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16595i32B3AE5B8A430639/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40841-searchvalue-prop.png" alt="40841-searchvalue-prop.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and &lt;STRONG&gt;Replacement Value&lt;/STRONG&gt; to &lt;/P&gt;&lt;P&gt;$1&lt;BR /&gt;$2&lt;BR /&gt;$3&lt;/P&gt;&lt;P&gt;Here we are replacing all the captured groups in replacement value, it will replaces the content of the flowfile with new content as we mentioned in replacement value property.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="40842-rt-config.png" style="width: 681px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16596i61FB0987E77F5760/image-size/medium?v=v2&amp;amp;px=400" role="button" title="40842-rt-config.png" alt="40842-rt-config.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so this ReplaceText processor gets&lt;STRONG&gt; input file&lt;/STRONG&gt; as&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;
&amp;lt;COMPS ReplyCode="0" ReplyText="Operation Successful"&amp;gt;
&amp;lt;COUNT Records="258"/&amp;gt;
&amp;lt;DELIMITER value="09"/&amp;gt;
&amp;lt;COLUMNS&amp;gt;Column1Column2Column3Column4Column5 &amp;lt;/COLUMNS&amp;gt;
&amp;lt;DATA&amp;gt;value11 value12 value13 value14 value15&amp;lt;/DATA&amp;gt;
&amp;lt;DATA&amp;gt;value21 value22 value23 value24 value25&amp;lt;/DATA&amp;gt;
&amp;lt;/COMPS&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output:-&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Column1Column2Column3Column4Column5 
value11 value12 value13 value14 value15
value21 value22 value23 value24 value25&lt;/PRE&gt;&lt;P&gt;You can use either ways which will best fit for your case :).&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 03:50:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212216#M69626</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T03:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212217#M69627</link>
      <description>&lt;P&gt;@Shu, I am close to resolving this with method1 you suggested, except that number of DATA elements is variable (could be thousands) and COLUMNS is a single xml node with 200+ fields, and output should be&lt;BR /&gt;&lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;Column1Column2Column3Column4Column5&lt;/LI&gt;&lt;LI&gt;value11 value12 value13 value14 value15&lt;/LI&gt;&lt;LI&gt;value21 value22 value23 value24 value25&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 17 Oct 2017 05:03:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212217#M69627</guid>
      <dc:creator>cpreddy74</dc:creator>
      <dc:date>2017-10-17T05:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212218#M69628</link>
      <description>&lt;P&gt;@Shu, I have tried with first solution but i am encountered with the following attached error .please help me to resolve my issue as it is urgent for me.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/92496-untitled.png"&gt;untitled.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 12:26:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212218#M69628</guid>
      <dc:creator>nagamalleswarij</dc:creator>
      <dc:date>2018-09-20T12:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212219#M69629</link>
      <description>&lt;P&gt;Hi I have tried the first solution but i am encountered with the following error. Please suggest me the solution.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/92495-untitled.png"&gt;untitled.png&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 20:14:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212219#M69629</guid>
      <dc:creator>nagamalleswarij</dc:creator>
      <dc:date>2018-09-20T20:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: EvaluateXPath can't return multiple node values</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212220#M69630</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/97208/nagamalleswarij.html" nodeid="97208"&gt;@satyadevi jagata&lt;/A&gt;&lt;P&gt;change the below property value in EvaluateXQuery processor to &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Destination
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;flowfile-attribute&lt;/PRE&gt;&lt;P&gt;Then try to re run the processor.&lt;/P&gt;&lt;P&gt;If the above property value set to &lt;STRONG&gt;flowfile-content&lt;/STRONG&gt; then Processor &lt;STRONG&gt;doesn't allow more than one query to be added&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;If the issue still doesn't resolved, please open a new question for more visibility to the community and &lt;/P&gt;&lt;P&gt;Add all the details what you have tried so far and sample data to reproduce the same issue.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 06:36:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EvaluateXPath-can-t-return-multiple-node-values/m-p/212220#M69630</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-09-21T06:36:06Z</dc:date>
    </item>
  </channel>
</rss>

