Create multiple xml file

Hello,

I need a bit of help - i need to create some xml files that contain certain variables like date and social security number. The file structure is quite simple, but i can’t figure out how to create them :frowning: The variables i managed to create, i just can’t figure out how to insert them.

Any suggestions?

Thank you,
Cristi

please share some more details with us. Best for this would be in this format:
sample input
expected output

Thanks

So, i have this model for the xml file:

<?xml version="1.0" encoding="utf-8"?>
<F2101 Req_id="2722" Internal_code="BTL002" Company_id="332426"  Message_date="202111111632" xmlns="">
  <persoane_fizice SSN="1940916297258" />
</F2101>

And i want to create multiple files, in which what i have bolded, needs to be a variable.

Let me know if i can tell more :slight_smile:

please use the </> format button from editor and rework on your sample. We cannot see the full sample. Thanks

i hope now I managed to make it more clear - so, what i want to have as a variable is the Message_Date and SSN and save it as a separate file after each modification.

for extraction we can do:
grafik

Deserializing the XML into xDoc | a XDocument variable

Extraction:
grafik

or a you looking on how to create this XML with the values from variables?

I want to create xml based on values from variables. Long story short - i have let’s say 5 clients that i have to verify in a state platform, and in order to that, i have to create for each one an xml file in which i need to change only those variables. Any hint or suggestion will help a lot :smiley:

@Cristian_Ionita

it can be done with one of many options:

XML Template Text file with placeholders and string replacements

text template (shortened):

<F2101 Req_id="#REQ#" /> | - strTemplate

strTemplate.Replace("#REQ#",“1234”)

XML Template File And XML API

grafik

XML Api - Full construction via XML API

we can show, when this is prefered

and as mentioned also other approaches are possible

I think that for my level and current need the first option would be best.
So, I should create a txt file template with "#REQ1#’, “#REQ2#” etc and use it to create xml files for each of the clients?
If so, could you please tell me what the workflow would be? I’m guessing that i will read the txt file and use a “for each row in data table”? But i’m not sure how to use and where the “strTramplate.Replace” do i assign it?

L.E.
Figured how to do the replace for each of the “#REQ#” - and the only question that remains, how to insert the variable as a replacement :slight_smile:

later/later Edit - figured it out, i was puting the variable in “”. Thanks a lot for your help and suggestions. I owe you one.

Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.