<?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: NiFi convert string to key/value pair in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143709#M106298</link>
    <description>&lt;P&gt;Wow, didn't know the xQuery could do this. Based on quick research it appears that fn:tokenize might be just what I'm looking for. I'll have to play with this to see if I can this to work. &lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2016 21:48:11 GMT</pubDate>
    <dc:creator>hans_feldmann</dc:creator>
    <dc:date>2016-07-25T21:48:11Z</dc:date>
    <item>
      <title>NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143706#M106295</link>
      <description>&lt;P&gt;i'm still learning the ropes of NiFi, I have some XML (See Below)&lt;/P&gt;&lt;PRE&gt;&amp;lt;measInfo measInfoId="1542455297"&amp;gt;
	&amp;lt;measTypes&amp;gt;1542455297 1542455298 1542455299 1542455300 1542455301 1542455302 1542455303 1542455304 1542455305 1542455306 1542455307 1542460296 1542460297 &amp;lt;/measTypes&amp;gt;
	&amp;lt;measValue measObjLdn="LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=0, Subboard Type=BASE_BOARD"&amp;gt;
		&amp;lt;measResults&amp;gt;116967973 585560 496041572 682500 0 12583680 72080 520454 46670568 73432 2205837 1000000 1000000 &amp;lt;/measResults&amp;gt;
	&amp;lt;/measValue&amp;gt;
	&amp;lt;measValue measObjLdn="LTHAB0113422/ETHPORT:Cabinet No.=0, Subrack No.=1, Slot No.=7, Port No.=1, Subboard Type=BASE_BOARD"&amp;gt;
		&amp;lt;measResults&amp;gt;0 0 0 0 0 0 0 0 0 0 0 0 0 &amp;lt;/measResults&amp;gt;
	&amp;lt;/measValue&amp;gt;
&amp;lt;/measInfo&amp;gt;


&lt;/PRE&gt;&lt;P&gt;I successfully parsed the XML, but need further processing. I'm looking for suggestions as to the best way to handle this. Ultimately I would like a key/value pair between MeasTypes and MeasResults to insert into Hbase or Pivot data into a Hive table (MeasType would get translated into a Column Name). The exact number of MeasTypes and MeasResults pairs is variable.&lt;/P&gt;&lt;PRE&gt;measTypes	measResults
1542455297	116967973
1542455298	585560
1542455299	496041572
1542455300	682500
1542455301	0
1542455302	12583680
1542455303	72080
1542455304	520454
1542455305	46670568
1542455306	73432
1542455307	2205837
1542460296	1000000
1542460297	1000000


&lt;/PRE&gt;&lt;P&gt;I have 10GB of XML arriving every 30 minutes, so efficiency is also a concern. I'm able to take the measTypes and put it into a file and parse it with a ExtractText and ReplaceText (using a Regex), so the next challenge is to replace the GetFIle with a feed from my existing XML template, how do I do it? Another Option is to InvokeScriptedProcessor (Maybe Python)? Sample code would be greatly appreciated. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 23:10:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143706#M106295</guid>
      <dc:creator>hans_feldmann</dc:creator>
      <dc:date>2016-07-22T23:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143707#M106296</link>
      <description>&lt;P&gt;One option I can think of is using xquery or xslt. &lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 20:17:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143707#M106296</guid>
      <dc:creator>mpandit</dc:creator>
      <dc:date>2016-07-25T20:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143708#M106297</link>
      <description>&lt;P&gt;Here are some NiFi XSLT references&lt;/P&gt;&lt;P&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.TransformXml/"&gt;https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.TransformXml/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/6104698/use-xsl-to-convert-an-xml-file-to-name-value-pair"&gt;http://stackoverflow.com/questions/6104698/use-xsl-to-convert-an-xml-file-to-name-value-pair&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 20:35:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143708#M106297</guid>
      <dc:creator>TimothySpann</dc:creator>
      <dc:date>2016-07-25T20:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143709#M106298</link>
      <description>&lt;P&gt;Wow, didn't know the xQuery could do this. Based on quick research it appears that fn:tokenize might be just what I'm looking for. I'll have to play with this to see if I can this to work. &lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 21:48:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143709#M106298</guid>
      <dc:creator>hans_feldmann</dc:creator>
      <dc:date>2016-07-25T21:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143710#M106299</link>
      <description>&lt;P&gt;Hi Hans&lt;/P&gt;&lt;P&gt;Did you manage to accomplish this using xquery? Your solution would be greatly appreciated. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 21:04:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143710#M106299</guid>
      <dc:creator>rbnaveen_kumar</dc:creator>
      <dc:date>2018-04-10T21:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi convert string to key/value pair</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143711#M106300</link>
      <description>&lt;P&gt;Sorry I did not get this to work in xQuery. I ended up using XSLT to do the transformation. &lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 01:49:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-convert-string-to-key-value-pair/m-p/143711#M106300</guid>
      <dc:creator>hans_feldmann</dc:creator>
      <dc:date>2018-04-11T01:49:50Z</dc:date>
    </item>
  </channel>
</rss>

