S
Simon Jefferies
Hello,
I'm trying to deserialize a document created with the following pieces of
code.
I get an exception "Additional information: There is an error in XML
document (2, 2).", why does this happen?
Serializing code:
Dim fs As New FileStream(Filename, FileMode.Create, FileAccess.Write)
Dim SoundTableItem As SoundTableItem = Nothing
For Each SoundTableItem In SoundItems
Dim XmlEntry As New
Xml.Serialization.XmlSerializer(GetType(SoundTableItem))
XmlEntry.Serialize(fs, SoundTableItem)
Next
fs.Close()
Deserializing code:
Dim fs As New FileStream(Filename, FileMode.Open, FileAccess.Read)
Dim tr As New Xml.XmlTextReader(fs)
Dim XmlEntry As New Xml.Serialization.XmlSerializer(GetType(SoundTableItem))
While Not tr.EOF()
Dim SoundEntry As SoundTableItem = Nothing
SoundEntry = XmlEntry.Deserialize(tr)
SoundItems.Add(SoundEntry)
End While
--
Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:[email protected]
www.headfirst.co.uk www.callofcthulhu.com
-
I'm trying to deserialize a document created with the following pieces of
code.
I get an exception "Additional information: There is an error in XML
document (2, 2).", why does this happen?
Serializing code:
Dim fs As New FileStream(Filename, FileMode.Create, FileAccess.Write)
Dim SoundTableItem As SoundTableItem = Nothing
For Each SoundTableItem In SoundItems
Dim XmlEntry As New
Xml.Serialization.XmlSerializer(GetType(SoundTableItem))
XmlEntry.Serialize(fs, SoundTableItem)
Next
fs.Close()
Deserializing code:
Dim fs As New FileStream(Filename, FileMode.Open, FileAccess.Read)
Dim tr As New Xml.XmlTextReader(fs)
Dim XmlEntry As New Xml.Serialization.XmlSerializer(GetType(SoundTableItem))
While Not tr.EOF()
Dim SoundEntry As SoundTableItem = Nothing
SoundEntry = XmlEntry.Deserialize(tr)
SoundItems.Add(SoundEntry)
End While
--
Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:[email protected]
www.headfirst.co.uk www.callofcthulhu.com
-