I have a problem with Deserializing a xml string.
I have a object I serialize:
MemoryStream buffer = new MemoryStream();
System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(myobject));
xmlSerializer.Serialize(buffer, schedule);
if I Deserialize the object after this code line, it works fine. But if I store the xml in code it Deserialize it gives me an error.
XmlDocument doc = new XmlDocument();
doc.Load(buffer);
string xml = doc.OuterXml;
MemoryStream XMLString = new MemoryStream();
byte[] firstString = uniEncoding.GetBytes(XMLString);
buffer.Write(firstString, 0 , firstString.Length);
schedule = (ScheduleDefinition) serializer.Deserialize(buffer);
I need the xml string as a parameter, so i need to be able to convert it back into the object. But I always get the message:
{"There is an error in XML document (1, 426)." }
Any other suggestions to accomplish this?
I have a object I serialize:
MemoryStream buffer = new MemoryStream();
System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(myobject));
xmlSerializer.Serialize(buffer, schedule);
if I Deserialize the object after this code line, it works fine. But if I store the xml in code it Deserialize it gives me an error.
XmlDocument doc = new XmlDocument();
doc.Load(buffer);
string xml = doc.OuterXml;
MemoryStream XMLString = new MemoryStream();
byte[] firstString = uniEncoding.GetBytes(XMLString);
buffer.Write(firstString, 0 , firstString.Length);
schedule = (ScheduleDefinition) serializer.Deserialize(buffer);
I need the xml string as a parameter, so i need to be able to convert it back into the object. But I always get the message:
{"There is an error in XML document (1, 426)." }
Any other suggestions to accomplish this?