I dunno if i'm on the right track here as I've never used classes to xml.
However, it's data so like any other form of data so I have always defined
my schema, loaded it and fed the structure into a datas et through
ReadXMLSchema & XML Text Reader as follows:
Dim fs As FileStream = New FileStream(fileName, FileMode.Open,
FileAccess.Read)
Dim xtr As XmlTextReader = New XmlTextReader(fs)
dsSettings = New DataSet
Try
dsSettings.ReadXmlSchema(xtr)
Catch ex As XmlException
MessageBox.Show(ex.ToString)
End Try
xtr.Close()
Then... loaded the XML file with data(in your case your class has the data)
with...
If File.Exists(SettingsFileName) Then
Dim fsXML As FileStream = New FileStream(SettingsFileName,
FileMode.Open, FileAccess.ReadWrite)
Dim xtrXML As XmlTextReader = New XmlTextReader(fsXML)
dsSettings.ReadXml(xtrXML)
xtrXML.Close()
Else
Return -1
End If
And used a getData function like:
Private Function GetSettings()
Dim tbl As DataTable = dsSettings.Tables("Settings")
If tbl.Rows.Count > 0 Then
Dim row As DataRow = tbl.Rows(0)
XMLData1 = row("data1")
XMLData2 = row("data2")....etc
Else
Return -1
End If
End Function
hope this helps