我正在尝试一个简单的例子来反序列化 vb.net 2008 中的 xml 文件,但某处肯定有一个简单的错误。
错误:
There is an error in XML document (1, 2).
xml文件:
<Item>test</Item>
VB代码:
Public Class xmlClass
Public Item As String
End 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