Serialization Help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bennett
    New Member
    • Jul 2007
    • 12

    Serialization Help!

    Hi

    I am just trying to get my head into serialization, i have created this

    Code:
    Imports System
    Imports System.Xml
    Imports System.Xml.Serialization
    
    <XmlRoot(ElementName:="RESPONSE")> Public Class RESPONSE
        <XmlElementAttribute(ElementName:="AVAILABILITY")> Public AVAILABILITY As AVAILABILITY
    End Class
    Public Class AVAILABILITY
        <XmlArray(ElementName:="CARS")> <XmlArrayItem(ElementName:="CAR", Type:=GetType(CAR))> Public CAR() As CAR
    End Class
    Public Class CAR
        <XmlElementAttribute()> Public NAME As String
    End Class
    I think this should generate XML like this
    <RESPONSE>
    <AVAILABILITY >
    <CARS>
    <CAR>
    <NAME></NAME>
    </CAR>
    <CAR>
    <NAME></NAME>
    </CAR>
    <CAR>
    <NAME></NAME>
    </CAR>
    </CARS>
    </AVAILABILITY>
    </RESPONSE>

    How do i add data into this serialization, using an arraylist.

    Cheers
    Bennett
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by bennett
    Hi

    I am just trying to get my head into serialization, i have created this
    ...
    How do i add data into this serialization, using an arraylist.

    Cheers
    Bennett
    Hi Bennett :)

    Welcome to TSDN (aka. theScripts). I hope you like it here!

    I think you are doing things the hard way (actually I've never seen serialization done like this).

    I suggest you check out the MSDN library.
    Start by checking out:

    Hope this helps you out!

    -Frinny

    Comment

    Working...