S
Skitsanos
Guys,
Have very strange issue with deserialization. Really need help,
because i just don't getting why the hell this not works in a way it
suppose to be.
Here is the sample object i serialize into XML:
<XmlRoot("CONTACTS")> _
Public Class Contacts
<XmlAttribute("version")> Public Version As String = "0.2"
<XmlElement(Type:=GetType(OrganizationType),
ElementName:="ORGANIZATION", IsNullable:=False,
Form:=XmlSchemaForm.Qualified), _
EditorBrowsable(EditorBrowsableState.Advanced)> _
Public __Organizations As OrganizationColectionType
<XmlIgnore()> _
Public Property Organizations() As OrganizationColectionType
Get
If __Organizations Is Nothing Then __Organizations =
New OrganizationColectionType()
Organizations = __Organizations
End Get
Set(ByVal Value As OrganizationColectionType)
__Organizations = Value
End Set
End Property
End Class
Deseriliazing i do via this function:
Public Function SetXml(ByVal obj As Object, ByVal XmlData As
String) As Object
Dim ser As New XmlSerializer(obj.GetType)
Dim ms As New
IO.MemoryStream(Text.Encoding.UTF8.GetBytes(XmlData))
Dim xr As New Xml.XmlTextReader(ms)
Debug.WriteLine("Can deserialize: " +
ser.CanDeserialize(xr).ToString)
Return ser.Deserialize(xr)
End Function
On ser.CanDeserialize it always return /TRUE/ that i assume tells that
source XML is fine. At least it says "Gets a value that indicates
whether this XmlSerializer can deserialize a specified XML document."
on http://msdn2.microsoft.com/en-us/li...tion.xmlserializer.candeserialize(VS.80).aspx
But problem is that actual deserialization is never happens. Object
not getting filled with data from XML.
If i take any other object to deserialize, i get my data, but objects
build like this are failed.
Is anyone have any idea wtf is wrong?
Cheers,
Evi.
Have very strange issue with deserialization. Really need help,
because i just don't getting why the hell this not works in a way it
suppose to be.
Here is the sample object i serialize into XML:
<XmlRoot("CONTACTS")> _
Public Class Contacts
<XmlAttribute("version")> Public Version As String = "0.2"
<XmlElement(Type:=GetType(OrganizationType),
ElementName:="ORGANIZATION", IsNullable:=False,
Form:=XmlSchemaForm.Qualified), _
EditorBrowsable(EditorBrowsableState.Advanced)> _
Public __Organizations As OrganizationColectionType
<XmlIgnore()> _
Public Property Organizations() As OrganizationColectionType
Get
If __Organizations Is Nothing Then __Organizations =
New OrganizationColectionType()
Organizations = __Organizations
End Get
Set(ByVal Value As OrganizationColectionType)
__Organizations = Value
End Set
End Property
End Class
Deseriliazing i do via this function:
Public Function SetXml(ByVal obj As Object, ByVal XmlData As
String) As Object
Dim ser As New XmlSerializer(obj.GetType)
Dim ms As New
IO.MemoryStream(Text.Encoding.UTF8.GetBytes(XmlData))
Dim xr As New Xml.XmlTextReader(ms)
Debug.WriteLine("Can deserialize: " +
ser.CanDeserialize(xr).ToString)
Return ser.Deserialize(xr)
End Function
On ser.CanDeserialize it always return /TRUE/ that i assume tells that
source XML is fine. At least it says "Gets a value that indicates
whether this XmlSerializer can deserialize a specified XML document."
on http://msdn2.microsoft.com/en-us/li...tion.xmlserializer.candeserialize(VS.80).aspx
But problem is that actual deserialization is never happens. Object
not getting filled with data from XML.
If i take any other object to deserialize, i get my data, but objects
build like this are failed.
Is anyone have any idea wtf is wrong?
Cheers,
Evi.