Last post Sep 17, 2010 07:40 AM by modig
Sep 17, 2010 12:40 AM|modig|LINK
I try to create a xml file based on a list of authors. I need to create a xml file with a structure like this..
And this should be created from a list that I have created. The method look like this...
Public Sub MakeXmlFile(ByVal MyAuthorList As List(Of AuthorHandler))
Dim CurrentAuthor As String
For Each row In MyAuthorList
CurrentAuthor = row.AuthorName
For Each BookRow In row.AuthorBookList 'Add all autors books to xml
I'm not sure on how to create the Xelement part and could use som help.
Sep 17, 2010 04:07 AM|smithspd|LINK
Try to use Xml Serialization and Deserialization.
Sep 17, 2010 07:13 AM|Martin_Honnen|LINK
Do you use .NET 3.5 or later? Then you could use
LINQ to XML e.g.
Dim root As XElement = <root>
<%= From author In MyAuthorList Select <author>
<AuthorName><%= author.AuthorName %></AuthorName>
<books><%= From book In author.AuthorBookList Select <book>
<title><%= book.Title %></title>
Sep 17, 2010 07:26 AM|ziyad67|LINK
Please check the following link.
Sep 17, 2010 07:40 AM|modig|LINK
Thanks for all tips.