the next day or so. Yes, Option Strict is on.
"Christoph Schittko [MVP]" <INVALIDEMAIL@austin.rr.com> wrote in message
news:u0ywPGNCFHA.392@TK2MSFTNGP14.phx.gbl...
> Wayne,
>
> In general, you should always be able to deserialize XML written with
> the XmlSerializer into instances of the same classes you used to
> serialize.
> Did you get it to work or do you still have problems? On a side note,
> I'm not a VB expert, but does your code compile with Option Strict on?
>
> HTH,
> Christoph Schittko
> MVP XML
>
http://weblogs.asp.net/cschittko >
>
>
> > -----Original Message-----
> > From: Wayne Wengert [mailto:wayneDONTWANTSPAM@wengert.com]
> > Posted At: Friday, January 28, 2005 8:41 AM
> > Posted To: microsoft.public.dotnet.xml
> > Conversation: Still Problems Serializing Arrays
> > Subject: Still Problems Serializing Arrays
> >
> > I am still stuck trying to create a Class to use for exporting and
> > importing
> > array data to/from XML. The format of the XML that I want to
> import/export
> > is shown below as is the Class and the code I am using to create a
> sample
> > XML file. I am trying to dimension the ArrayOfJudgeEntity to have two
> sets
> > of the JudgeTableEntity values. When I run the code I get an error
> that
> > the
> > XML is not correct.
> >
> > I jsut can't get my head around the array serialization.
> >
> > Any help is much appreciated
> >
> > Wayne
> >
> > =================== Desired XML ==============
> > <?xml version="1.0" encoding="utf-8"?>
> > <ArrayOfJudgeTableEntity xmlns:xsd="
http://www.w3.org/2001/XMLSchema" > > xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"> > > <JudgeTableEntity>
> > <JudgeId>63371991-cdf9-4cc5-99c1-a42c599498f8</JudgeId>
> > <JudgeFirstName>Kristen</JudgeFirstName>
> > <JudgeLastName>O'Melia</JudgeLastName>
> > <JudgeType>Equipment</JudgeType>
> > </JudgeTableEntity>
> > <JudgeTableEntity>
> > <JudgeId>ce2c0c6e-4094-43da-9d8c-9726d81b017e</JudgeId>
> > <JudgeFirstName>Smith</JudgeFirstName>
> > <JudgeLastName>Dan</JudgeLastName>
> > <JudgeType>Movement</JudgeType>
> > </JudgeTableEntity>
> > </ArrayOfJudgeTableEntity>
> >
> > ============= Class Definition =============
> > Public Class ArrayOfJudgeTableEntity
> > '<XmlArray("JudgeTableEntity"), XmlArrayItem("JudgeTableEntity",
> > IsNullable:=True)> Public JudgeTableEntityX() As JudgeTableEntity
> > <XmlElement("JudgeTableEntity", IsNullable:=True)> Public
> > JudgeTableEntity()
> > Public Sub New()
> > End Sub
> > Public Sub New(ByVal j As Integer)
> > ReDim Preserve JudgeTableEntity(j)
> > End Sub 'New
> > End Class
> > Public Class JudgeTableEntity
> > <XmlElement("JudgeID")> Public JudgeID As String
> > <XmlElement("JudgeFirstName")> Public JudgeFirstName As String
> > <XmlElement("JudgeLastName")> Public JudgeLastName As String
> > <XmlElement("JudgeType")> Public JudgeType As String
> > Public Sub New()
> > End Sub 'New
> > Public Sub New(ByVal id As String, ByVal fn As String, ByVal ln As
> > String, ByVal type As String)
> > JudgeID = id
> > JudgeType = type
> > JudgeFirstName = fn
> > JudgeLastName = ln
> > End Sub
> > End Class
> >
> > ================ Code to Build Sample Output =================
> > Dim Judge1 As New JudgeTableEntity("ID1", "Shirlee", "Whitcomb", "GE")
> > Dim Judge2 As New JudgeTableEntity("ID2", "Joe", "Courtney",
> > "TaP")
> > Dim array2 As New ArrayOfJudgeTableEntity(1)
> > array2.JudgeTableEntity(0) = Judge1
> > array2.JudgeTableEntity(1) = Judge2
> > Dim ser As New XmlSerializer(GetType(ArrayOfJudgeTableEntity))
> > AddHandler ser.UnknownNode, AddressOf serializer_UnknownNode
> > AddHandler ser.UnknownElement, AddressOf
> serializer_UnknownElement
> > Dim writer As New XmlTextWriter("c:\Temp\judgestest.xml",
> > System.Text.Encoding.UTF8)
> > ' write a human readable file
> > writer.Formatting = Formatting.Indented
> > Try
> > ser.Serialize(writer, array2)
> > Catch ex As Exception
> > MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
> > 'End
> > End Try
> > writer.Close()
>
>