Problem in deserializing XML
Hi, need help here. I'm having problems deserializing an xml string. Here're the codes.
=================================
#CLASS TO SERIALIZE
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://test")]
public class msgenvelope {
public string mig;
}
====================================
#FORM CODE
public SOAPClient.WebReference.msgenvelope xml_submittask = new SOAPClient.WebReference.msgenvelope();
...
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(SOAPClient.WebReference.msgenvelope));
System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
xmldoc.LoadXml("TEST");
System.IO.MemoryStream mem = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(xmldoc.OuterXml));
try
{
xml_submittask = (SOAPClient.WebReference.msgenvelope)x.Deserialize(mem);
}
catch (System.Exception ex_e)
{
label1.Text += "\n" + ex_e.Message;
}
===================================================
#INPUT FILE
H
====================================================
I keep getting the message:
There is an error in XML document (1, 2)
I tried some stuffs but just couldn't get it to work right. Hope somebody could help. I've looked all over the net and asked my colleagues but nothing seems to work =/
thanks