Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing a xml file in a string builder and then returning the Xml. Now i want to read that Xml file content . But for reading how i pass that return value to doc.load(),
Posted

1 solution

XmlDocument.Load[^] has four overloads - one of them takes a stream.

So, convert your StringBuilder to a stream:
C#
StringBuilder sb = new StringBuilder();
...
Stream stream = new MemoryStream(System.Text.Encoding.Unicode.GetBytes(sb.ToString()))
and pass that to the XmlDocument
 
Share this answer
 
Comments
H.Brydon 23-Mar-13 17:41pm    
Right on (+5)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900