Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML string to dataset

Status
Not open for further replies.

cmhunt

Programmer
Apr 17, 2001
119
GB
Hi

I'm using a webservice which returns a string which contains an XML fragment. All I need to do is read this into a dataset but I can't figure out how to do it. If I write the string to a file and then read the XML file in to the dataset using ReadXml() it works fine.

I'm sure it can't be hard. Any help would be appreciated.

Thanks

Chris
 
Here is what I used for String.
Code:
           dsRsp.Namespace = ""

            ' Get XML response into a DataSet
            Dim dsXmlTr As System.Xml.XmlTextReader
            Try
                dsXmlTr = New System.Xml.XmlTextReader _
                    (New IO.StringReader(sXML))
                dsRsp.ReadXml(dsXmlTr, XmlReadMode.IgnoreSchema)
            Catch ex As Exception
                Dim myex As New System.ApplicationException( _
                    "HandleAceResponse: " & dsRsp.DataSetName & ": Response=" & sXML, ex)
                ei.FailureCode = RPFailureCode.DataSetReadXmlError
                ei.ErrorCode = "XX"
                ei.ErrorMessage = myex.ToString
                LogAbendMessage(ei.ErrorMessage)
                Return ei
            Finally
                Try
                    ' Close XMLTextReader and underlying StreamReader
                    dsXmlTr.Close()
                Catch
                End Try

Forms/Controls Resizing/Tabbing
Compare Code
Generate Sort Class in VB
Check To MS)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top