I have a blob (XYZ) that receives multiple XML files in same format. See below
XML file 1:
<Product>
<ID>001</ID>
<Name>John</Name>
<Designation>Developer</Designation>
</Product>
XML file 2:
<Product>
<ID>002</ID>
<Name>Peter</Name>
<Designation>Tester</Designation>
</Product>
XML file 3:
<Product>
<ID>003</ID>
<Name>Arun</Name>
<Designation>Support</Designation>
</Product>
XML file 4:
<Product>
<ID>004</ID>
<Name>Swetha</Name>
<Designation>Analyst</Designation>
</Product>
XML file 5:
<Product>
<ID>005</ID>
<Name>Gokul</Name>
<Designation>Maintainence</Designation>
</Product>
I need to merge all these files to a single XML file like below and put into another blob (ABC).
Merged XML file:
<xml>
<Product>
<ID>001</ID>
<Name>John</Name>
<Designation>Developer</Designation>
</Product>
<Product>
<ID>002</ID>
<Name>Peter</Name>
<Designation>Tester</Designation>
</Product>
<Product>
<ID>003</ID>
<Name>Arun</Name>
<Designation>Support</Designation>
</Product>
<Product>
<ID>004</ID>
<Name>Swetha</Name>
<Designation>Analyst</Designation>
</Product>
<Product>
<ID>005</ID>
<Name>Gokul</Name>
<Designation>Maintainence</Designation>
</Product>
</xml>
I may need one like this.
What I have tried so far is below one.
using (var jw = new XmlTextWriter(sw)) //sw holds the o/p location to store the merged files
{
jw.WriteStartElement("root");
int i = 0;
int c = list.Count();
foreach (var item in list)
{
if (i > 0)
await jw.WriteRawAsync("\r\n");
var blobdata = await OutputContainerService.GetContentAsync(input.InputLocation + "/" + item);
await jw.WriteRawAsync(blobdata);
i++;
}
jw.WriteEndElement();
await jw.FlushAsync();
}
How could I achieve this using C#.NET?
Option 1 :
Option 2:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.