ASP.NET and C# sample code:
Creating the following XML file in C# .NET Using LINQ
<Books BookType="TECH">
<Book Code="123" name="ASP.NET" />
<Book Code="123" name="C#.NET" />
</Request>
List<string> items = new List<string>();
//Fill the list items
-----------
-----------
XElement xmlFile = new XElement(XName.Get("Books"), new XAttribute("BookType ", "TECH"),
from i in items
select new XElement(XName.Get("Book"), new XAttribute("Code", "123"),
new XAttribute("name", i)
));
No comments:
Post a Comment