<?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: how to find and replace in xml in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270108#M48127</link>
    <description>Hi&lt;BR /&gt;You can use tXMLMap.&lt;BR /&gt;Just add tReplace between tFileInputXML and tXMLMap.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
    <pubDate>Wed, 25 Jul 2012 03:29:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-25T03:29:18Z</dc:date>
    <item>
      <title>how to find and replace in xml</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270105#M48124</link>
      <description>Hi,
&lt;BR /&gt;I need to convert some XML files but I cannot figure out how.
&lt;BR /&gt;The target will be the same XML except that for a particular element down in the tree, content of the element would be replaced with by some other string.
&lt;BR /&gt;
&lt;PRE&gt;&amp;lt;? version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;ADI&amp;gt;&lt;BR /&gt;  &amp;lt;Metadata&amp;gt;&lt;BR /&gt;    &amp;lt;AMS Product="MOD" Asset_Name="xxx" Description="yyy" Provider_ID="zzz" Creation_Date="2012-06-21" Asset_ID="0001" Version_Major="6" Version_Minor="0" /&amp;gt;&lt;BR /&gt;    &amp;lt;App_Data Value="xxx" Name="Metadata_Spec_Version" App="MOD"/&amp;gt;&lt;BR /&gt;    &amp;lt;App_Data Value="" Name="Provider_Content_Tier" App="MOD"/&amp;gt;&lt;BR /&gt;  &amp;lt;/Metadata&amp;gt;&lt;BR /&gt;  &amp;lt;Asset&amp;gt;&lt;BR /&gt;    &amp;lt;Metadata&amp;gt;&lt;BR /&gt;      &amp;lt;AMS Product="MOD" Asset_Name="xxx" Description="ppp" Provider_ID="01" Creation_Date="2012-06-21" Asset_ID="0001" Version_Major="6" Version_Minor="0" /&amp;gt;&lt;BR /&gt;      &amp;lt;App_Data Value="xxx" Name="Metadata_Spec_Version" App="MOD"/&amp;gt;&lt;BR /&gt;      &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;      &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;      &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;        ...&lt;BR /&gt;    &amp;lt;/Metadata&amp;gt;&lt;BR /&gt;    &amp;lt;Asset&amp;gt;&lt;BR /&gt;      &amp;lt;Metadata&amp;gt;&lt;BR /&gt;        &amp;lt;AMS Product="MOD" Asset_Name="xxx" Description="ppp" Provider_ID="01" Creation_Date="2012-06-21" Asset_ID="0001" Version_Major="6" Version_Minor="0" /&amp;gt;&lt;BR /&gt;        &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;        &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;        ...&lt;BR /&gt;      &amp;lt;/Metadata&amp;gt;&lt;BR /&gt;      &amp;lt;Content Value="aaa.mpg"/&amp;gt;&lt;BR /&gt;    &amp;lt;/Asset&amp;gt;&lt;BR /&gt;    &amp;lt;Asset&amp;gt;&lt;BR /&gt;      &amp;lt;Metadata&amp;gt;&lt;BR /&gt;        &amp;lt;AMS Product="MOD" Asset_Name="yyy" Description="qqq" Provider_ID="02" Creation_Date="2012-06-21" Asset_ID="0002" Version_Major="6" Version_Minor="0" /&amp;gt;&lt;BR /&gt;        &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;        ...&lt;BR /&gt;      &amp;lt;/Metadata&amp;gt;&lt;BR /&gt;      &amp;lt;Content Value="bbb.mpg"/&amp;gt;&lt;BR /&gt;    &amp;lt;/Asset&amp;gt;&lt;BR /&gt;    &amp;lt;Asset&amp;gt;&lt;BR /&gt;      &amp;lt;Metadata&amp;gt;&lt;BR /&gt;        &amp;lt;AMS Product="MOD" Asset_Name="zzz" Description="rrr" Provider_ID="03" Creation_Date="2012-06-21" Asset_ID="0003" Version_Major="6" Version_Minor="0" /&amp;gt;&lt;BR /&gt;        &amp;lt;App_Data ... /&amp;gt;&lt;BR /&gt;        ...&lt;BR /&gt;      &amp;lt;/Metadata&amp;gt;&lt;BR /&gt;      &amp;lt;Content Value="ccc.jpg"/&amp;gt;&lt;BR /&gt;    &amp;lt;/Asset&amp;gt;&lt;BR /&gt;  &amp;lt;/Asset&amp;gt;&lt;BR /&gt;&amp;lt;/ADI&amp;gt;&lt;/PRE&gt;
&lt;BR /&gt;the target XML file will be all same except "aaa.mpg", "bbb.mpg" and "ccc.jpg" will be replaced by say "new_aaa.mpg", "new_bbb.mpg", etc.
&lt;BR /&gt;Note that in the structure of the XML, Asset can be defined recursively. 
&lt;BR /&gt;I first thought of reading XML line by line and doing a String find/replace but this is not a robust solution as the file in question is XML and the "find string" can theoretically appear anywhere in the file.
&lt;BR /&gt;so will that be something like?
&lt;BR /&gt;tFileInputXML --&amp;gt; tXMLMap --&amp;gt; tFileOutputCSV</description>
      <pubDate>Mon, 23 Jul 2012 17:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270105#M48124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-23T17:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to find and replace in xml</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270106#M48125</link>
      <description>Hi&lt;BR /&gt;If you think simply replacement is not a robust solution, the best way is to create a job as seen below.&lt;BR /&gt;tFileInputXML--&amp;gt;tReplace--&amp;gt;tAdvancedOutputXML&lt;BR /&gt;Use treplace to replace strings in the specified column.&lt;BR /&gt;Then use tAdvancedOutuputXML to recreate this xml file.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Tue, 24 Jul 2012 02:27:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270106#M48125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-24T02:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to find and replace in xml</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270107#M48126</link>
      <description>Hi Pedro,
&lt;BR /&gt;Thank you very much for the answer.
&lt;BR /&gt;Can I ask something more to understand things better.
&lt;BR /&gt;In my proposed solution, at the first tFileInputXML, I was able to extract the whole root element into a "Document" type column and pass it to tXMLMap. After your answer, I understand that this is going to incur a second XML parse which is inefficient, but do you think, it is possible to do a find/replace with tXMLMap?
&lt;BR /&gt;I am trying to understand the use cases for tXMLMap, as my case above will be doing something more complex in future. It will need to replace the value of a specific element by calculating it from sibling elements or from attributes of its parent element. Would that be practical to use a tXMLMap in those cases?</description>
      <pubDate>Tue, 24 Jul 2012 11:28:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270107#M48126</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-24T11:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to find and replace in xml</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270108#M48127</link>
      <description>Hi&lt;BR /&gt;You can use tXMLMap.&lt;BR /&gt;Just add tReplace between tFileInputXML and tXMLMap.&lt;BR /&gt;Regards,&lt;BR /&gt;Pedro</description>
      <pubDate>Wed, 25 Jul 2012 03:29:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270108#M48127</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T03:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to find and replace in xml</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270109#M48128</link>
      <description>Thank you Pedro but I think my problem is not about the replace bit as I think I could do it within tXML as well by using an itermediate Variable. After spending some time on the components I think it is more about handling a recursive XML structure in Talend. I will come up with a new topic on that. 
&lt;BR /&gt;Cheers.</description>
      <pubDate>Wed, 25 Jul 2012 11:32:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-find-and-replace-in-xml/m-p/2270109#M48128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T11:32:29Z</dc:date>
    </item>
  </channel>
</rss>

