<?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>topic Re: tExtractXMLField only gets the first element in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342611#M110461</link>
    <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;.. No, the number could vary all the time. Thanks anyway.&lt;BR /&gt;I'll file a request in the Suggestions forum for a more flexible looping Xpath.&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;If the number could vary all the time, you have to use tExtractXMLField components, one for product elements and another one for merchant elements, for example: 
&lt;BR /&gt;the xml document flow---tReplicate--main--tExtractXMLField _1--main--file or memory 
&lt;BR /&gt; --main--tExtractXMLField _2--main--file or memory 
&lt;BR /&gt;and then do the join between the two output if needed. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Shong</description>
    <pubDate>Mon, 18 Jul 2011 04:26:44 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-07-18T04:26:44Z</dc:date>
    <item>
      <title>tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342604#M110454</link>
      <description>I have XML coming into the tExtractXMLField that looks like this:&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;search_results product_limit="25" product_offset="0" brand_id="3595"&amp;gt;&lt;BR /&gt;  &amp;lt;products total_count="24"&amp;gt;&lt;BR /&gt;    &amp;lt;product retail_price="239.99" merchant_id="2826"  id="286777730"/&amp;gt;&lt;BR /&gt;    &amp;lt;product retail_price="239.99" merchant_id="2431"  id="297971660"/&amp;gt;&lt;BR /&gt;    &amp;lt;product retail_price="219.99" merchant_id="2431"  id="397971661"/&amp;gt;&lt;BR /&gt;    &amp;lt;product retail_price="239.99" merchant_id="2823"  id="354015223"/&amp;gt;&lt;BR /&gt;  &amp;lt;/products&amp;gt;	&lt;BR /&gt;  &amp;lt;merchants&amp;gt;&lt;BR /&gt;    &amp;lt;merchant product_count="8" network_id="5"  merchant_type_id="9" id="2826"/&amp;gt;&lt;BR /&gt;    &amp;lt;merchant product_count="7" network_id="2"  merchant_type_id="9" id="2431"/&amp;gt;&lt;BR /&gt;    &amp;lt;merchant product_count="3" network_id="2"  merchant_type_id="9" id="2823"/&amp;gt;&lt;BR /&gt;  &amp;lt;/merchants&amp;gt;&lt;BR /&gt;&amp;lt;/search_results&amp;gt;  &lt;BR /&gt;In the tExtractXMLField, the Loop XPath query is set to: "/search_results"&lt;BR /&gt;And the Mapping to get the "id" field from the "product" elements is set to "./products/product/@id"&lt;BR /&gt;But I only get 1 row of output, and it's always the first product in the set (id="286777730" in example above)&lt;BR /&gt;I've tried setting the "Get Nodes" checkbox for that column (the doc says that setting this will "recuperate" the contents of the select node - not sure what this means)&lt;BR /&gt;I've also tried setting the Loop Xpath query to "/search_results/products" and the mapping for "id" to "./product/@id" ... no luck.&lt;BR /&gt;It must be something wrong with either my Loop Xpath query or my mapping Xpath ... &lt;BR /&gt;Anyone have any idea why I'm not seeing 4 rows  of output?&lt;BR /&gt;Edit: The &amp;lt;products&amp;gt; section of the example XML was shortened for use in this example, but does actually have 24 &amp;lt;product&amp;gt; elements. And I only get #1 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Sat, 16 Nov 2024 12:48:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342604#M110454</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T12:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342605#M110455</link>
      <description>Hi
&lt;BR /&gt;In you case, you need to set the Loop XPath query as: "/search_results/products/product"
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Sat, 16 Jul 2011 07:48:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342605#M110455</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-16T07:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342606#M110456</link>
      <description>Wooo hooo! Thank you Shong!
&lt;BR /&gt;I set the Loop Xpath query to "/search_results/products/product", and then the Xpath query for a column to "./@id" and now I get all the elements!
&lt;BR /&gt;But now what if I also want to get the id for each of the "merchant" elements? I think that's why I was attempting to use a higher-level Loop Xpath query like "/search_results", thinking that I could then populate columns for the different sections using "./products/product/@id" and then also "./merchants/merchant/@id" 
&lt;BR /&gt;But I guess that's not possible?</description>
      <pubDate>Sat, 16 Jul 2011 13:05:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342606#M110456</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-16T13:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342607#M110457</link>
      <description>Hi 
&lt;BR /&gt;Using another tExtractXMLField to extract the emrchant element just like you did on product element, and then do a join between the two output result if needed.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Mon, 18 Jul 2011 02:10:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342607#M110457</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-18T02:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342608#M110458</link>
      <description>I just tried the "backing up" syntax to back out of the /products/product and try and then get to merchants/merchant in the Xpath query: &lt;BR /&gt;"../../merchants/merchant/@id"&lt;BR /&gt;But that only give me the first merchant of the set. &lt;BR /&gt;Do I really have to use 2 tExtractXMLField  components, one for products and one for merchants? They are in the same XML document -- there must be some easy way to get at both sets of data that I'm not seeing.</description>
      <pubDate>Mon, 18 Jul 2011 02:19:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342608#M110458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-18T02:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342609#M110459</link>
      <description>Hi 
&lt;BR /&gt;If you are sure there are always a fixed number of product elements and merchant elements, you can set the xpath query as below to get the value of the N element: 
&lt;BR /&gt;products/product&amp;lt;N&amp;gt;/@id 
&lt;BR /&gt;Please see my screenshot. 
&lt;BR /&gt; 
&lt;BR /&gt;Best regard 
&lt;BR /&gt;Shong</description>
      <pubDate>Mon, 18 Jul 2011 02:53:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342609#M110459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-18T02:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342610#M110460</link>
      <description>.. No, the number could vary all the time. Thanks anyway. 
&lt;BR /&gt;I'll file a request in the Suggestions forum for a more flexible looping Xpath.</description>
      <pubDate>Mon, 18 Jul 2011 03:39:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342610#M110460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-18T03:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342611#M110461</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;.. No, the number could vary all the time. Thanks anyway.&lt;BR /&gt;I'll file a request in the Suggestions forum for a more flexible looping Xpath.&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;If the number could vary all the time, you have to use tExtractXMLField components, one for product elements and another one for merchant elements, for example: 
&lt;BR /&gt;the xml document flow---tReplicate--main--tExtractXMLField _1--main--file or memory 
&lt;BR /&gt; --main--tExtractXMLField _2--main--file or memory 
&lt;BR /&gt;and then do the join between the two output if needed. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Mon, 18 Jul 2011 04:26:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342611#M110461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-18T04:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342612#M110462</link>
      <description>This is a somewhat related question so I'll post it in here. I'm trying to use tExtractXMLFields to parse some output from tStandardizeRow.
&lt;BR /&gt;Example input coming from tStandardizeRow:
&lt;BR /&gt;&amp;lt;record&amp;gt;
&lt;BR /&gt;&amp;lt;NumberOnly&amp;gt;469-491&amp;lt;/NumberOnly&amp;gt;
&lt;BR /&gt;&amp;lt;NumberOnly&amp;gt;499-523&amp;lt;/NumberOnly&amp;gt;
&lt;BR /&gt;&amp;lt;UNMATCHED&amp;gt;
&lt;BR /&gt; &amp;lt;UNDEFINED&amp;gt;&amp;amp;&amp;lt;/UNDEFINED&amp;gt;
&lt;BR /&gt;&amp;lt;/UNMATCHED&amp;gt;
&lt;BR /&gt;&amp;lt;/record&amp;gt;
&lt;BR /&gt;
&lt;BR /&gt;When I run this through tExtractXMLFields with path of "/record" it will only extract the first NumberOnly field. Is there any way to extract all of them?
&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 09 Aug 2011 08:11:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342612#M110462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-09T08:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342613#M110463</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;When I run this through tExtractXMLFields with path of "/record" it will only extract the first NumberOnly field. Is there any way to extract all of them?&lt;BR /&gt;Thanks&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;To get all of NumberOnly field, you should set the loop path as "/record/NumberOnly", so now the loop element is NumberOnly, not record. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Tue, 09 Aug 2011 08:14:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342613#M110463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-09T08:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342614#M110464</link>
      <description>Hi Shong, 
&lt;BR /&gt;I have set the xpath loop to "record/NumberOnly" as you suggested, but now I'm having trouble setting the xPathQuery to extract the field. I have tried "NumberOnly" but that gave blank since there is no NumberOnly element inside itself. What should the xPathQuery be set to? 
&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 10 Aug 2011 02:27:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342614#M110464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-10T02:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractXMLField only gets the first element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342615#M110465</link>
      <description>Hi
&lt;BR /&gt;I suggest you to create a XML metadata with wizards, you are able to set the xpath loop element and the xpathQuery by drag&amp;amp;drop columns. 
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 10 Aug 2011 02:34:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractXMLField-only-gets-the-first-element/m-p/2342615#M110465</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-10T02:34:56Z</dc:date>
    </item>
  </channel>
</rss>

