473,386 Members | 2,129 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,386 software developers and data experts.

How do I populate a DataSet from a XML string?

I have a string containing valid XML.
How do I populate a dataset based on the string, without reference to an XML
schema or writing the XML to file and reading it back in again?
Nov 12 '05 #1
2 9384


Goldsworth_Systems wrote:
I have a string containing valid XML.
How do I populate a dataset based on the string, without reference to an XML
schema or writing the XML to file and reading it back in again?


You need an XML schema I think that describes the structure of the XML,
then it is no problem to read in the XML into an XmlDataDocument. But
without a schema it is not possible to associate the XML with a DataSet,
whether the XML is read from a file or from a string doesn't really matter.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Hi - I think I've cracked it - the following code seems to work:

Public Shared Function bDSOpenFromXML(ByVal vsXML As String, ByRef wdsReturn
As DataSet) As Boolean
' Creates a dataset based on the specified XML string
' Returns true for success

Dim rdr As New System.IO.StringReader(vsXML)
wdsReturn = New DataSet
wdsReturn.ReadXml(rdr)

bDSOpenFromXML = True
End Function

"Martin Honnen" wrote:


Goldsworth_Systems wrote:
I have a string containing valid XML.
How do I populate a dataset based on the string, without reference to an XML
schema or writing the XML to file and reading it back in again?


You need an XML schema I think that describes the structure of the XML,
then it is no problem to read in the XML into an XmlDataDocument. But
without a schema it is not possible to associate the XML with a DataSet,
whether the XML is read from a file or from a string doesn't really matter.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3

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

Similar topics

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...
9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
1
by: JIM.H. | last post by:
Hello, Here is the part of my code, I need to add a datagrid and populate is from this sql string. Can you write the rest of the code? Dim Da As New OdbcDataAdapter Dim Ds As New DataSet Dim...
3
by: crjunk | last post by:
I have 4 different databases that I'm having to pull data from in order to populate a datagrid. I am able to do this, but my problem is that because I'm pulling the data from 4 different...
3
by: Paul D. Fox | last post by:
I would like to read from Active Directory and populate a dataset to be passed in a Web Service. I can get the data from AD just fine, but can I populate a dataset with these values and do a...
16
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
2
by: Tim Kelley | last post by:
Is it possible to populate a grid using code (not binding it to a datasource). Is there something like an additem method? Thanks,
6
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
When I check the syntax of dataset, It seems that dataset can only read data from file. (e.g., datset.read(string filename), dataset.readxml(string filename)). If I have a string with XML format...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.