3
Answers

converting XML to string

sauravchat2002

sauravchat2002

20y
1.7k
1
i want to obtain data in XML format from dataset into a string i have done the following: Dim memstr As New MemoryStream Dim xmlpath As String = "C:\logintable.xml" Dim doc As New System.Xml.XmlDocument Dim writer As New XmlTextWriter(memstr, Encoding.UTF8) Dim returndata As String Dim buf() As Byte If Not IsPostBack Then dataset1.Clear() dataadapter.Fill(dataset1) dataset1.WriteXml(xmlpath) End If doc.Load(xmlpath) doc.Save(writer) buf = memstr.ToArray() returndata = Encoding.UTF8.GetString(buf, 0, buf.Length) writer.Close() xsltoutput.Text = returndata but the output string doesnot contains any XML tag. It is simply showing the node values in a string like: sauravc123Saurav But in XML(in the file mentioned as 'xmlpath' in the code) it was: sauravc 123 Saurav

Answers (3)