I would like to create an XMLstring that looks like this:
<ONLINE>
<CHATTER>
<ID>1</ID>
<NICK>John</NICK>
</CHATTER>
<CHATTER>
<ID>2</ID>
<NICK>Mark</NICK>
</CHATTER>
</ONLINE>
Right now, I am only able to serialize it to this:
<ONLINE>
<CHATTER>
<ID>1</ID>
<NICK>John</NICK>
</CHATTER>
</ONLINE>
I don't know how to create a class so that I can serialize to more <CHATTER> objects. My code looks like this right now:
Public Class ONLINE
Private _chatter As New CHATTER
Public Property chatter() As chatter
Get
Return _chatter
End Get
Set(ByVal chatter As chatter)
_chatter = chatter
End Set
End Property
End Class
Public Class CHATTER
Private _id As String
Private _nick As String
Public Property id() As String
Get
Return _id
End Get
Set(ByVal id As String)
_id = id
End Set
End Property
Public Property nick() As String
Get
Return _nick
End Get
Set(ByVal nick As String)
_nick = nick
End Set
End Property
End Class
And the function like this:
Dim online As New ONLINE
online.chatter.id = "1"
online.chatter.nick = "John"
online.chatter.id = "2"
online.chatter.nick = "Mark"
xs_ONLINE.Serialize(sw, online)
Return sw.ToString
Maybe I am totally wrong with this, do you have any idea how to solve this? Thanks!
<ONLINE>
<CHATTER>
<ID>1</ID>
<NICK>John</NICK>
</CHATTER>
<CHATTER>
<ID>2</ID>
<NICK>Mark</NICK>
</CHATTER>
</ONLINE>
Right now, I am only able to serialize it to this:
<ONLINE>
<CHATTER>
<ID>1</ID>
<NICK>John</NICK>
</CHATTER>
</ONLINE>
I don't know how to create a class so that I can serialize to more <CHATTER> objects. My code looks like this right now:
Public Class ONLINE
Private _chatter As New CHATTER
Public Property chatter() As chatter
Get
Return _chatter
End Get
Set(ByVal chatter As chatter)
_chatter = chatter
End Set
End Property
End Class
Public Class CHATTER
Private _id As String
Private _nick As String
Public Property id() As String
Get
Return _id
End Get
Set(ByVal id As String)
_id = id
End Set
End Property
Public Property nick() As String
Get
Return _nick
End Get
Set(ByVal nick As String)
_nick = nick
End Set
End Property
End Class
And the function like this:
Dim online As New ONLINE
online.chatter.id = "1"
online.chatter.nick = "John"
online.chatter.id = "2"
online.chatter.nick = "Mark"
xs_ONLINE.Serialize(sw, online)
Return sw.ToString
Maybe I am totally wrong with this, do you have any idea how to solve this? Thanks!