[resolved] Open XML files and modify content

One Star

[resolved] Open XML files and modify content

Hi all,
I want to open a group of xml files that are in a specific folder one by one. I want to modify a line inside each of them
and then save them.
How can i perform that?

Regards
Moderator

Re: [resolved] Open XML files and modify content

Hi,
You can use tfilelist to get these xml files where are in a specific folder one by one and then edit your xml in output file.
The work flow should be: tfilelist-->tfileinputxml-->tAdvancedFileOutputXML.
See my screenshots
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Open XML files and modify content

thank,
but i am affraid it could not help.
My problem is that i want to change the string "<?xml version="1.1" encoding="UTF-8"?>" to
"<?xml version="1.0" encoding="UTF-8"?>" at the header of the xml file.
Where can i see this string in order to change it?
Regards
Community Manager

Re: [resolved] Open XML files and modify content

thank,
but i am affraid it could not help.
My problem is that i want to change the string "<?xml version="1.1" encoding="UTF-8"?>" to
"<?xml version="1.0" encoding="UTF-8"?>" at the header of the xml file.
Where can i see this string in order to change it?
Regards

Hi
Use a tFileList to iterate each XML file, and use a tFileInputFullRow to read the XML line by line, link it to a tReplace to replace version="1.1" with version="1.0", and regenarate the XML file in another folder, please see my screenshots for details.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Open XML files and modify content

Thank you shong
it helped me !
Regards
One Star

Re: [resolved] Open XML files and modify content

Is this approach also recommend for replacing single values in XML elements?
Moderator

Re: [resolved] Open XML files and modify content

Hi ohofrichter,
What's your XML structure? Could you set an example for your case with input and expected output values so that we can see if this approach is suitable for you.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Open XML files and modify content

Another problem: how to replace particular lines based on an external lookup?
Example:
<NodeA>
<NodeB key="Text1">0099</Wert>
<NodeB key="Text2">0100</Wert>
</NodeA>
lookup table:
0099;0100
Only in the line with key="Text1" 0099 has to be replaced by 0100.
The lookup table shall only contain the numerals.
In the attached screenshot you can see the job I created for this requirement. Can I configure component tFileInputFullRow to handle only particular lines? Or is there another solution for such an requirement?