I am trying a simple example for deserialization of an xml file in vb.net 2008, but there must be a simple mistake somewhere.
Error:
There is an error in XML document (1, 2).
xml file:
<Item>test</Item>
vb code:
Public Class xmlClass
Public Item As String
End Class
…and in the form class:
Private Sub Deserialize()
Dim serializer As New XmlSerializer(GetType(xmlClass))
Dim reader As New FileStream("c:\tmp\tmp2.xml", FileMode.Open)
Dim xi As xmlClass
xi = CType(serializer.Deserialize(reader), xmlClass)
End Sub
Try:
You need to put the class element around the field value. I confirmed this works using your above code with VS 2012.