Hi All
I have created XML File with XMLDocument in ASP.NET
than i want send or show this file in browser to visitors.
without saving it to disk. How can i do that?
i want to show (MyXML) in explorer. or post it to customers?
Dim dst As DataSet
dst = ReturnDatasetFromSql(db, "Select * from Customers")
Dim MyXML As XmlDocument
MyXML[/color red] = DataTableToXML(dst.Tables(0))
Private Function DataTableToXML(ByVal table As DataTable) As XmlDocument
Dim xml As New XmlDocument
xml.LoadXml("<tableData/>")
For Each dr As DataRow In table.Rows
Dim rowElem As XmlElement
rowElem = xml.CreateElement("row")
For Each col As DataColumn In table.Columns
Dim colElem As XmlElement
colElem = xml.CreateElement(col.ColumnName)
colElem.InnerText = dr(col).ToString()
rowElem.AppendChild(colElem)
Next
xml.DocumentElement.AppendChild(rowElem)
Next dr
Return xml
End Function
I have created XML File with XMLDocument in ASP.NET
than i want send or show this file in browser to visitors.
without saving it to disk. How can i do that?
i want to show (MyXML) in explorer. or post it to customers?
Dim dst As DataSet
dst = ReturnDatasetFromSql(db, "Select * from Customers")
Dim MyXML As XmlDocument
MyXML[/color red] = DataTableToXML(dst.Tables(0))
Private Function DataTableToXML(ByVal table As DataTable) As XmlDocument
Dim xml As New XmlDocument
xml.LoadXml("<tableData/>")
For Each dr As DataRow In table.Rows
Dim rowElem As XmlElement
rowElem = xml.CreateElement("row")
For Each col As DataColumn In table.Columns
Dim colElem As XmlElement
colElem = xml.CreateElement(col.ColumnName)
colElem.InnerText = dr(col).ToString()
rowElem.AppendChild(colElem)
Next
xml.DocumentElement.AppendChild(rowElem)
Next dr
Return xml
End Function