I'm using this code to try and load an xmlDocument into a serializable object
VB Code:
  1. Public Shared Function LoadObjectFromXmlDoc(ByVal x As System.Xml.XmlDocument, ByVal objType As Type) As Object
  2.         Try
  3.             Dim tmpObj As Object
  4.             Dim oXS As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(objType)
  5.             Dim oStm As New System.IO.MemoryStream()
  6.  
  7.             x.Save(oStm)
  8.             tmpObj = oXS.Deserialize(oStm)
  9.             oStm.Close()
  10.             Return tmpObj
  11.         Catch ex As Exception
  12.             Return Nothing
  13.         End Try
  14.     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:
<?xml version="1.0" encoding="utf-16" ?> 
- <ArrayOfSearchResults xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SearchResults>
  <Show>Dream Team</Show> 
  <Url>http://www.tv.com/dream-team/show/5430/summary.html?full_summary=1&tag=showspace_links;full_summary</Url> 
  <Number>0</Number> 
  </SearchResults>
- <SearchResults>
  <Show>Time Team</Show> 
  <Url>http://www.tv.com/time-team/show/21725/summary.html?full_summary=1&tag=showspace_links;full_summary</Url> 
  <Number>0</Number> 
  </SearchResults>
</ArrayOfSearchResults>