[2005] XML deserialization


I'm using this code to try and load an xmlDocument into a serializable object
VB Code: Public Shared Function LoadObjectFromXmlDoc(ByVal x As System.Xml.XmlDocument, ByVal objType As Type) As Object Try Dim tmpObj As Object Dim oXS As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(objType) Dim oStm As New System.IO.MemoryStream() x.Save(oStm) tmpObj = oXS.Deserialize(oStm) oStm.Close() Return tmpObj Catch ex As Exception Return Nothing End Try End Function
But I keep getting an error saying "There is an error in XML document (0, 0).". The inner exception is "{"Root element is missing."}". But that's not true. It is a valid xml document. I serialize a class to create this document. This is a sample of what the xml file looks like when I save it to a file.

Code: - - Dream Team http://www.tv.com/dream-team/show/5430/summary.htmlfull_summary=1&tag=showspace_links;full_summary 0 - Time Team http://www.tv.com/time-team/show/21725/summary.htmlfull_summary=1&tag=showspace_links;full_summary 0
Posted On: Saturday 3rd of November 2012 12:50:36 PM Total Views:  215
View Complete with Replies