How to convert a string to required xml format in c#.net
If suppose we are having data in string as
"XXXX
YYYY
ZZZZ
CCCC"
I have required output like based on each and every row should generate with name of
Example
<filed1>XXXX></Filed1>
<filed2>YYYY></Filed2>
<filed3>ZZZZ></Filed3>
<filed4>CCCC></Filed4>
You can use LINQ to XML to build XML documents in a very elegant way:
Output: