<?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: tXMLMap convert attribute to name/value element in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363194#M127156</link>
    <description>&lt;P&gt;Hi Shong,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you send me that job to tharanibalan.v@gmail.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Tharanibalan&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jun 2018 06:51:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-06-08T06:51:14Z</dc:date>
    <item>
      <title>tXMLMap convert attribute to name/value element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363192#M127154</link>
      <description>Hi, I am trying to use TOS for Data Integration to convert an input XML into another general purpose XML structure much like a name/value structure.
&lt;BR /&gt;Here is my input XML:
&lt;BR /&gt;&amp;lt;invoice id="id1" no="no1" date="date1"&amp;gt;
&lt;BR /&gt; &amp;lt;amount&amp;gt;123.45&amp;lt;/amount&amp;gt;
&lt;BR /&gt; &amp;lt;due&amp;gt;2013-03-01&amp;lt;/due&amp;gt;
&lt;BR /&gt; &amp;lt;details&amp;gt;
&lt;BR /&gt; &amp;lt;item&amp;gt;
&lt;BR /&gt; &amp;lt;description&amp;gt;tran1&amp;lt;/description&amp;gt;
&lt;BR /&gt; &amp;lt;value&amp;gt;value1&amp;lt;/value&amp;gt;
&lt;BR /&gt; &amp;lt;/item&amp;gt;
&lt;BR /&gt; &amp;lt;item&amp;gt;
&lt;BR /&gt; &amp;lt;description&amp;gt;tran2&amp;lt;/description&amp;gt;
&lt;BR /&gt; &amp;lt;value&amp;gt;value2&amp;lt;/value&amp;gt;
&lt;BR /&gt; &amp;lt;/item&amp;gt; 
&lt;BR /&gt; &amp;lt;item&amp;gt;
&lt;BR /&gt; &amp;lt;description&amp;gt;tran3&amp;lt;/description&amp;gt;
&lt;BR /&gt; &amp;lt;value&amp;gt;value3&amp;lt;/value&amp;gt;
&lt;BR /&gt; &amp;lt;/item&amp;gt; 
&lt;BR /&gt; &amp;lt;/details&amp;gt;
&lt;BR /&gt;&amp;lt;/invoice&amp;gt;
&lt;BR /&gt;Here is my target output XML:
&lt;BR /&gt;&amp;lt;statement acc="id1" xkey="no1"&amp;gt;
&lt;BR /&gt; &amp;lt;field name="date"&amp;gt;date1&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;field name="amount"&amp;gt;123.45&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;field name="due"&amp;gt;2013-03-01&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;section name="details"&amp;gt;
&lt;BR /&gt; &amp;lt;secion name="item" occ="1"&amp;gt;
&lt;BR /&gt; &amp;lt;field name="description"&amp;gt;tran1&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;field name="value"&amp;gt;value1&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;/section&amp;gt;
&lt;BR /&gt; &amp;lt;secion name="item" occ="2"&amp;gt;
&lt;BR /&gt; &amp;lt;field name="description"&amp;gt;tran2&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;field name="value"&amp;gt;value2&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;/section&amp;gt;
&lt;BR /&gt; &amp;lt;secion name="item" occ="3"&amp;gt;
&lt;BR /&gt; &amp;lt;field name="description"&amp;gt;tran3&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;field name="value"&amp;gt;value3&amp;lt;/field&amp;gt;
&lt;BR /&gt; &amp;lt;/section&amp;gt;
&lt;BR /&gt; &amp;lt;/section&amp;gt;
&lt;BR /&gt;&amp;lt;/statement&amp;gt;
&lt;BR /&gt;My challenge is that I could not find a way to map a source attribute invoice/@date into a target element &amp;lt;field name="date"&amp;gt;date1&amp;lt;/field&amp;gt; in which the attribute name "date" becomes the name of the element &amp;lt;field&amp;gt; and the attribute value "date1" becaomes the element value.
&lt;BR /&gt;Any idea how can I achieve this?
&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Mon, 25 Feb 2013 16:47:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363192#M127154</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2013-02-25T16:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: tXMLMap convert attribute to name/value element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363193#M127155</link>
      <description>Hi 
&lt;BR /&gt;In this case, there are multiple loop elements in output xml file. The attribute name in the source file will be a fixed attribute value of the element &amp;lt;field&amp;gt; base on the line number, see pic2, here I create a demo job to show how to achieve this kind of requirement with the 'Append the source xml file' feature of tAdvancedFileOutputXML component. 
&lt;BR /&gt;result: 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-15"?&amp;gt;&lt;BR /&gt;&amp;lt;root&amp;gt;&lt;BR /&gt;  &amp;lt;statement acc="id1" xkey="no1"&amp;gt;&lt;BR /&gt;    &amp;lt;sections name="details"&amp;gt;&lt;BR /&gt;      &amp;lt;section name="item" occ="1"&amp;gt;&lt;BR /&gt;        &amp;lt;field name="description"&amp;gt;tran1&amp;lt;/field&amp;gt;&lt;BR /&gt;        &amp;lt;field name="value"&amp;gt;value1&amp;lt;/field&amp;gt;&lt;BR /&gt;      &amp;lt;/section&amp;gt;&lt;BR /&gt;      &amp;lt;section name="item" occ="2"&amp;gt;&lt;BR /&gt;        &amp;lt;field name="description"&amp;gt;tran2&amp;lt;/field&amp;gt;&lt;BR /&gt;        &amp;lt;field name="value"&amp;gt;value2&amp;lt;/field&amp;gt;&lt;BR /&gt;      &amp;lt;/section&amp;gt;&lt;BR /&gt;      &amp;lt;section name="item" occ="3"&amp;gt;&lt;BR /&gt;        &amp;lt;field name="description"&amp;gt;tran3&amp;lt;/field&amp;gt;&lt;BR /&gt;        &amp;lt;field name="value"&amp;gt;value3&amp;lt;/field&amp;gt;&lt;BR /&gt;      &amp;lt;/section&amp;gt;&lt;BR /&gt;    &amp;lt;/sections&amp;gt;&lt;BR /&gt;    &amp;lt;field name="date"&amp;gt;date1&amp;lt;/field&amp;gt;&lt;BR /&gt;    &amp;lt;field name="amount"&amp;gt;123.45&amp;lt;/field&amp;gt;&lt;BR /&gt;    &amp;lt;field name="due"&amp;gt;2013-03-01&amp;lt;/field&amp;gt;&lt;BR /&gt;  &amp;lt;/statement&amp;gt;&lt;BR /&gt;&amp;lt;/root&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;Please email me if you want the job! 
&lt;BR /&gt;Shong 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDxg.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154327iC9BBD91171641619/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDxg.png" alt="0683p000009MDxg.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDxl.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136017i4EC199A2ADD7CB0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDxl.png" alt="0683p000009MDxl.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 04 Mar 2013 04:30:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363193#M127155</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T04:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: tXMLMap convert attribute to name/value element</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363194#M127156</link>
      <description>&lt;P&gt;Hi Shong,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you send me that job to tharanibalan.v@gmail.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Tharanibalan&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 06:51:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tXMLMap-convert-attribute-to-name-value-element/m-p/2363194#M127156</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-08T06:51:14Z</dc:date>
    </item>
  </channel>
</rss>

