Converting XML to string
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
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mahesh ChandRank #1 · 393.3K reputationPosted Dec 1, 2003, 8:25 AM EST
sauravchat20025 reputationPosted Dec 1, 2003, 6:43 PM EST
tsuman_inRank #6,374 · 268 reputationPosted Dec 6, 2003, 4:41 AM EST