473,396 Members | 1,765 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,396 software developers and data experts.

XML file as a string into a Dataset.

I suspect the anwer to this is going to be obvious, but can someone give me
a clue here as I am presently doing this in a roundabout way. I am using an
API that gives me an XML file as a string. I am presently using Streamwriter
to write an XML file to disk and then reading the XML file into a Dataset.

Best wishes

Paul Bromley
Nov 21 '05 #1
4 943
Paul,

You mean
\\\
ds.WriteXML("path")
And
ds.ReadXML("path")
///

To do it to disk
or do you mean

\\\\
Dim sw As New System.IO.StringWriter
ds.WriteXml(sw)
Dim mystring As String = sw.tostring
///
Deserialize
\\\
Dim sr As New System.IO.StringReader(mystring)
Dim ds2 As New DataSet
ds2.ReadXml(sr)
///
To do it in memory?

I hope this helps a little bit?

Cor
Nov 21 '05 #2
Paul,

"Paul Bromley" <fl*******@dsl.pipex.com> schrieb:
I suspect the anwer to this is going to be obvious, but can someone give me
a clue here as I am presently doing this in a roundabout way. I am using
an
API that gives me an XML file as a string.


\\\
Dim XmlString As String = ...
Dim d As New DataSet()
d.ReadXml(New StringReader(XmlString))
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Addendum:

I forgot to add that you will have to import the 'System.IO' namespace in
order to use the code I posted. 'StringReader' is contained in this
namespace.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Many thanks Cor & Herfried for this - will try it a bit later tonight.
Ceratinly a lot easier than my code as I had to delete the file and then
checking the new file existed before loading it into the dataset each time
that I run the code.

Best wishes

Paul Bromley

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...
Addendum:

I forgot to add that you will have to import the 'System.IO' namespace in
order to use the code I posted. 'StringReader' is contained in this
namespace.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

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

Similar topics

2
by: Eric Caron | last post by:
Hi I try to import file in a dataset. How I can do this ?
2
by: s-galit | last post by:
how can i read xml file to dataSet? this is what i have written so far- dim db1 as database db1=new dataBase db1.readXmlSchema("fileName.xsd") db1.readXml("fileName.xml") what am i...
0
by: arshad | last post by:
Hi, I am facing some problems in reading XML file into dataset in vb.net. The XML is having some duplicate tabels. I am getting the error message saying "The same table(imei_details) cannot be...
1
by: Anandan | last post by:
Hi, This is regarding Dataset Filter: WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcards in a LIKE comparison. If the string in a LIKE clause contains a * or %,...
1
by: jack | last post by:
Hi all, Im thinking a way ahead. can any one help tell me whether it is possible to convery a cvs file into dataset and then save into the database directly.. Thank for replying me...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
0
by: sparty1022 | last post by:
Read many of the posting but still doen't understand the process. I have a dataset with child records. I have a specific XML "Account.XSD" format that I need to write this out to. How do I...
0
by: vrushalik | last post by:
Hi, I want to read data from xml file into Dataset. So if i have 2 tables in dataset, then how to list data for both tables in one xml file? Is this possible? I listed data in single file like...
2
by: tirumalab | last post by:
public void loadgrid() { string folder = @"D:\Newfolder\tirumala"; if (Directory.Exists(folder)) { DataSet ds = new DataSet(); ...
0
by: yogesha | last post by:
i have to edit the xml file by displating it on the datafridview.. so first i want to load the xml file into dataset. i used dataset.readxml(path); but the problem is my xml file contents...
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: 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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.