c# - Illegal characters in path error in XML Deserilation -
I have received XML feedback from my clients, I can not dynamize XML as a string, this is a path Illegal characters in
throws an error, so now I save the file to the temporary folder and retrieve it. Is it possible to deserialize without saving the XML file?
string xml = post (); XmlSerializer deserializer = New XmlSerializer (typef (envelope)); TextReader Reader = New Stream Reader (XML); & Lt; - Invalid character in path error - & gt; Object obj = deserializer Dairyialize (Reader); Envelope xmldata = (envelope) obj; Reader.Close ();
Edit 1 -
XML serializer serial lizard = new XML CERTILIZER (typef (envelope)); (Using TextWriter author = new streamer (xml)) & lt; - StringWriter is possible here? - & gt; {Serializer.Serialize (Author, XmlData); }
Instead of a streamReader
, use one , Which takes.
TextReader Reader = New StringRadder (XML);
To write, use it:
string output; XmlSerializer serializer = new XmlSerializer (typef (envelope)); (Using TextWriter author = new streamer (xml)) & lt; - StringWriter is possible here? - & gt; {Serializer.Serialize (Author, XmlData); Output = author Toasting (); }
Comments
Post a Comment