Here is a perfect code that works for me but problem is it will be obsolete soon... i need to convert so that i wont keep getting warning messages on my application
Dim xm As New XmlDataDocument()
Dim sr As StreamReader = Nothing
Dim MapPathString As String = HttpContext.Current.Server.MapPath("~\" & XsdFileName.ToString.Trim & ".xsd")
sr = New StreamReader(MapPathString)
xm.DataSet.ReadXmlSchema(sr)
xm.LoadXml(xmlString)
sr.Close()
Return xm.DataSet
so it basically takes an STRING and convert it first to XML document using the Schema Def File(xsd) and then return a data set of the XML file.
I have found a solution, just so that if someone is stuck on this...here is the alternate code...
Dim myDataSet As New DataSet()
Dim MapPathString As String = HttpContext.Current.Server.MapPath("~\" & XsdFileName.ToString.Trim & ".xsd")
Dim dt As DataTable = Nothing
Using strRd As StringReader = New StringReader(xmlString)
Using xmlRd As XmlReader = XmlReader.Create(strRd)
myDataSet.ReadXmlSchema(MapPathString)
myDataSet.ReadXml(xmlRd)
End Using
End Using
Return myDataSet
Thanks.
Marked as answer by kabir.khan.net on Nov 22, 2011 02:56 PM
kabir.khan.n...
Member
100 Points
369 Posts
String To XML Using XSD and return DataSet
Nov 21, 2011 07:25 PM|LINK
Here is a perfect code that works for me but problem is it will be obsolete soon... i need to convert so that i wont keep getting warning messages on my application
Dim xm As New XmlDataDocument() Dim sr As StreamReader = Nothing Dim MapPathString As String = HttpContext.Current.Server.MapPath("~\" & XsdFileName.ToString.Trim & ".xsd") sr = New StreamReader(MapPathString) xm.DataSet.ReadXmlSchema(sr) xm.LoadXml(xmlString) sr.Close() Return xm.DataSetso it basically takes an STRING and convert it first to XML document using the Schema Def File(xsd) and then return a data set of the XML file.
Any help will be much appreciated.
Thanks.
Kabir
kabir.khan.n...
Member
100 Points
369 Posts
Re: String To XML Using XSD and return DataSet
Nov 21, 2011 08:28 PM|LINK
Any one?
kabir.khan.n...
Member
100 Points
369 Posts
Re: String To XML Using XSD and return DataSet
Nov 22, 2011 02:56 PM|LINK
I have found a solution, just so that if someone is stuck on this...here is the alternate code...
Dim myDataSet As New DataSet() Dim MapPathString As String = HttpContext.Current.Server.MapPath("~\" & XsdFileName.ToString.Trim & ".xsd") Dim dt As DataTable = Nothing Using strRd As StringReader = New StringReader(xmlString) Using xmlRd As XmlReader = XmlReader.Create(strRd) myDataSet.ReadXmlSchema(MapPathString) myDataSet.ReadXml(xmlRd) End Using End Using Return myDataSetThanks.