<?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: Creating multiple xml elements in tXMLMap under specific circumstances in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355749#M121436</link>
    <description>&lt;P&gt;You are probably the first (here) to encounter this kind of problem... you are The ONE to create the best practice! ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestion ... extra steps and if element==null then ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;You probably have to do it for each element to find out if its null&lt;/P&gt;&lt;P&gt;And if its null ... build up a xml string... put it into a global var and inject it into the final xml with a regex replace...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or javacode (I would use something like this):&lt;/P&gt;&lt;P&gt;tXMLMap with final complete xml doc and alter/transform it.&lt;/P&gt;&lt;PRE&gt; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = factory.newDocumentBuilder();
 Document doc = builder.parse(xmlFile);
 TransformerFactory tFactory = TransformerFactory.newInstance();
 Transformer tFormer = tFactory.newTransformer();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jul 2018 12:21:44 GMT</pubDate>
    <dc:creator>Jesperrekuh</dc:creator>
    <dc:date>2018-07-17T12:21:44Z</dc:date>
    <item>
      <title>Creating multiple xml elements in tXMLMap under specific circumstances</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355748#M121435</link>
      <description>&lt;P&gt;Hello Talend experts,&lt;/P&gt; 
&lt;P&gt;I'm a&amp;nbsp;newcommer&amp;nbsp;in&amp;nbsp;Talend. I need to create an integration SOAP-&amp;gt;SOAP synchronous scenario but because of both sides limitations I need to create &amp;lt;fieldsToIgnore&amp;gt; element for each element that is not present in inbound soap envelope.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mapping.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LzIG.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144392i5459698C0F64123F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LzIG.png" alt="0683p000009LzIG.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;So for example when there is no &amp;lt;LastName&amp;gt;, &amp;lt;Gender&amp;gt; and &amp;lt;Phone&amp;gt; element in inbound message, outbound structure has to contain&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;&amp;lt;fieldsToIgnore&amp;gt;LastName&amp;lt;/fieldsToIgnore&amp;gt;&amp;lt;fieldsToIgnore&amp;gt;Gender&amp;lt;/fieldsToIgnore&amp;gt;&amp;lt;fieldsToIgnore&amp;gt;Phone&amp;lt;/fieldsToIgnore&amp;gt;&lt;/PRE&gt; 
&lt;P&gt;before the &amp;lt;sap_acc&amp;gt; element.&lt;/P&gt; 
&lt;P&gt;And my question is: what's the best practice to approach this kind of problem? How to construct that kind of expression?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks in advance,&lt;/P&gt; 
&lt;P&gt;Michał&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:57:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355748#M121435</guid>
      <dc:creator>Kaszanka</dc:creator>
      <dc:date>2024-11-16T07:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple xml elements in tXMLMap under specific circumstances</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355749#M121436</link>
      <description>&lt;P&gt;You are probably the first (here) to encounter this kind of problem... you are The ONE to create the best practice! ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestion ... extra steps and if element==null then ...&amp;nbsp;&lt;/P&gt;&lt;P&gt;You probably have to do it for each element to find out if its null&lt;/P&gt;&lt;P&gt;And if its null ... build up a xml string... put it into a global var and inject it into the final xml with a regex replace...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or javacode (I would use something like this):&lt;/P&gt;&lt;P&gt;tXMLMap with final complete xml doc and alter/transform it.&lt;/P&gt;&lt;PRE&gt; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = factory.newDocumentBuilder();
 Document doc = builder.parse(xmlFile);
 TransformerFactory tFactory = TransformerFactory.newInstance();
 Transformer tFormer = tFactory.newTransformer();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 12:21:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355749#M121436</guid>
      <dc:creator>Jesperrekuh</dc:creator>
      <dc:date>2018-07-17T12:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple xml elements in tXMLMap under specific circumstances</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355750#M121437</link>
      <description>&lt;P&gt;Thanks for the answer! It's really helpful.&lt;/P&gt; 
&lt;P&gt;I have two more (I hope simple) question then:&lt;/P&gt; 
&lt;P&gt;Is there a way to get&amp;nbsp;element name, no it's value, in mapping expression?&lt;/P&gt; 
&lt;P&gt;And how can I iterate over source elements, is there some kind of java collection with the elements available in the expression field?&lt;/P&gt; 
&lt;P&gt;Because if&amp;nbsp;the answer is yes for both questions then it will be relatively easy to do the way I need to.&lt;/P&gt; 
&lt;P&gt;Thanks once more for your advice.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:16:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355750#M121437</guid>
      <dc:creator>Kaszanka</dc:creator>
      <dc:date>2018-07-18T09:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple xml elements in tXMLMap under specific circumstances</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355751#M121438</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Is there a way to get&amp;nbsp;element name, no it's value, in mapping expression?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, but not sure how&amp;nbsp;XPath works and version in tXMLMap -&amp;nbsp; but it's&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://www.w3.org/TR/xpath/#function-name" target="_blank" rel="noreferrer nofollow noopener noreferrer"&gt;name()&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;XPath 2.0 only:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="pln"&gt;//userprofilesettings/*/name()&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;XPath 1.0 and 2.0:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="pln"&gt;name(//&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;userprofilesettings&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;/*)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt; And how can I iterate over source elements&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;There's a &lt;STRONG&gt;&lt;EM&gt;loop&lt;/EM&gt; &lt;/STRONG&gt;over which you can set, but I suggest make two steps (tXMLMap) one for the missing elements to loop over and one for the actual data/output...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 12:13:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Creating-multiple-xml-elements-in-tXMLMap-under-specific/m-p/2355751#M121438</guid>
      <dc:creator>Jesperrekuh</dc:creator>
      <dc:date>2018-07-18T12:13:18Z</dc:date>
    </item>
  </channel>
</rss>

