If I wanted to serizlize and deserialize an XML like this in VB:
<SeveralListsOfPeople>
<ListOfPeople groupname="Friends">
<Person name="John">
</Person>
<Person name="Mary">
</Person>
</ListOfPeople>
<ListOfPeople groupname="Family">
<Person name="Karen">
</Person>
<Person name="Kyle">
</Person>
</ListOfPeople>
<ListOfPeople groupname="Enemies">
<Person name="Ben">
</Person>
<Person name="Chris">
</Person>
</ListOfPeople>
</SeveralListsOfPeople>
How would I add the attribute "groupname" to "ListsOfPeople"? I can't figure out how to add attributes to lists or arrays. I only know how to add attributes to objects and the root.
This is how I thought it should work:
Imports System.Xml.Serialization
<Serializable>
<XmlRoot("SeveralListsOfPeople")>
Public Class SeveralListsOfPeople
Public Property ListOfPeople As List(Of Person)
<XmlAttribute("groupname")> Public Property name() As String
Public Sub New()
End Sub
End Class
<Serializable>
Public Class Person
Public Property title As String
Public Property age As String
<XmlAttribute("name")> Public Property name() As String
Public Sub New()
End Sub
End Class