XML file as a string into a Dataset. | Bytes (2024)

Paul Bromley

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

Subscribe Reply

4 XML file as a string into a Dataset. | Bytes (1) 953 XML file as a string into a Dataset. | Bytes (2)

Cor Ligthert

Paul,

You mean
\\\
ds.WriteXML("pa th")
And
ds.ReadXML("pat h")
///

To do it to disk
or do you mean

\\\\
Dim sw As New System.IO.Strin gWriter
ds.WriteXml(sw)
Dim mystring As String = sw.tostring
///
Deserialize
\\\
Dim sr As New System.IO.Strin gReader(mystrin g)
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

Herfried K. Wagner [MVP]

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(Xm lString))
///

--
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

Herfried K. Wagner [MVP]

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

Paul Bromley

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******** *****@tk2msftng p13.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 3470

import file in dataset problem

by: Eric Caron |last post by:

Hi I try to import file in a dataset. How I can do this ?

.NET Framework

2 1366

read xml file to dataset

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 missing??

.NET Framework

2426

Problems in reading XML file into dataset in vb.net

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 the child table in two nested relations" Here is the XML structure i am trying to read...

.NET Framework

1 6672

Wildcards are not allowed in the middle of the String (Dataset Fil

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 %, those characters should be escaped in brackets (). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example or

Visual Basic .NET

1 899

.csv file to dataset

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...

ASP.NET

4 12788

reading text file to dataset

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 to read text file but could not get the data in correct format. All columns are not coming in dataset and rows are messing up. Suggestions please ???

ASP.NET

1928

Writing XML File from Dataset

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 marry these (2) items to create the output file. Dim dataSet As DataSet = New DataSet("AccountRecord") PremisesAdapter.Fill(dataSet, "Premises") SupAdapter.Fill(dataSet, "Supplemental")

.NET Framework

1542

xml file for dataset with data for multiple tables

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 <tables> <ATable> <Table1> one row <all columns data for table1>

XML

2 1117

Binding XMl file to dataset...and updating the changes

by: tirumalab |last post by:

public void loadgrid() { string folder = @"D:\Newfolder\tirumala"; if (Directory.Exists(folder)) { DataSet ds = new DataSet(); string xml = @"D:\Newfolder\tirumala\myxml.xml"; ds.ReadXml(xml); dataGridView1.DataSource = ds; dataGridView1.DataMember = ds.Tables.ToString();

.NET Framework

637

How to read xml file into dataset

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 childnodes of same name so the file will not be loaded since dataset cant have same table names.. pls any solutions.. thank u in advance

.NET Framework

8397

Changing the language in Windows 10

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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

8919

Problem With Comparison Operator <=> in G++

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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...

C / C++

8821

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...

Online Marketing

1 8599

The easy way to turn off automatic updates for Windows 10/11

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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...

Windows Server

5696

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...

C# / C Sharp

4225

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

Networking - Hardware / Configuration

4409

Windows Forms - .Net 8.0

by: adsilva |last post by:

A Windows Forms form does not have the event Unload, like VB6. What one acts like?

Visual Basic .NET

1 2813

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

2 2052

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

XML file as a string into a Dataset. | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 5792

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.