G
Guest
I try to serialize a simpley array:
Dim arr() As Integer = {1, 2, 3, 4}
Dim tmpStream As New IO.FileStream("C:\str.xml", IO.FileMode.Create)
tmpSerializer = New XmlSerializer(GetType(Integer()))
tmpSerializer.Serialize(tmpStream, arr)
arr = tmpSerializer.Deserialize(tmpStream)
XML file looks like:
<?xml version="1.0"?>
<ArrayOfInt xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<int>1</int>
<int>2</int>
<int>3</int>
<int>4</int>
</ArrayOfInt>
I'm getting an error when I'm trying to Deserialize:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There is an error in XML document (0, 0).
What's the problem of my code?
Dim arr() As Integer = {1, 2, 3, 4}
Dim tmpStream As New IO.FileStream("C:\str.xml", IO.FileMode.Create)
tmpSerializer = New XmlSerializer(GetType(Integer()))
tmpSerializer.Serialize(tmpStream, arr)
arr = tmpSerializer.Deserialize(tmpStream)
XML file looks like:
<?xml version="1.0"?>
<ArrayOfInt xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<int>1</int>
<int>2</int>
<int>3</int>
<int>4</int>
</ArrayOfInt>
I'm getting an error when I'm trying to Deserialize:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: There is an error in XML document (0, 0).
What's the problem of my code?