473,378 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How do I get XML in a string loaded into a dataset?

Using VB.net

I have a string var (myXMLString) that contains some XML (gotten via a web
service that returns xml)

I want to load this xml into a dataset (myDataSet).

But the myDataSet.ReadXML() method doesn't take a string as one of its
overloads.
If I write myXMLString to a file, then I can read it into myDataSet, but I
want to skip that step.

How can I load a string of XML directly into a DataSet?

Thanks,

Kevin
Nov 12 '05 #1
2 990
"Kevin Thomas" <Se**********@Spam.com> wrote in message news:ec**************@TK2MSFTNGP12.phx.gbl...
But the myDataSet.ReadXML() method doesn't take a string as one of its overloads. : : How can I load a string of XML directly into a DataSet?


Kevin,

Try wrapping the string in a System.IO.StringReader (which is a subclass of
TextReader). There is an overload of ReadXml( ) on DataSet that takes a
TextReader.

Dim sr As System.IO.StringReader
sr = New System.IO.StringReader( strXmlData)
dataSet1.ReadXml( sr)
Derek Harmon
Nov 12 '05 #2
That's perfect.

Thanks for your help,

Kevin

"Derek Harmon" <lo*******@msn.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Kevin Thomas" <Se**********@Spam.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
But the myDataSet.ReadXML() method doesn't take a string as one of its
overloads.

: :
How can I load a string of XML directly into a DataSet?


Kevin,

Try wrapping the string in a System.IO.StringReader (which is a subclass
of
TextReader). There is an overload of ReadXml( ) on DataSet that takes a
TextReader.

Dim sr As System.IO.StringReader
sr = New System.IO.StringReader( strXmlData)
dataSet1.ReadXml( sr)
Derek Harmon

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Chuck Bowling | last post by:
I'm having problems doing an efficient keyword search on a text file likely to be smaller than 100k. I have a keyword list of about 200 strings and I need to search the file and mark all of the...
2
by: | last post by:
I've just started using managed extensions to write a web service, the learning curve seems pretty steep! Currently I'm stuck at this bit: my web service gets a String * of XML data. I want to...
1
by: Zachary Hartnett | last post by:
I was trying to write a routine this morning that would open a given assembly, walk the inheritance tree of classes in the assembly, and provide a list of classes in the assembly that inherit from...
0
by: Zachary Hartnett | last post by:
This might be a double post... I'm not sure why the forum looked like it deleted this message... I was trying to write a routine this morning that would open a given assembly, walk the...
7
by: Sharon | last post by:
I have successfully loaded a DataSet object with a XML schema (XSD). Now I wish to populate the tables that was created in the DataSet. I have an XML file/string that contain all the needed data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.