473,804 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple question about ReadXml and WriteXml

Hello!

Assume the following :
1. I create a DataSet with some DataRelation.
2. I then use WriteXml to write the DataSet to an Xml document using
DataRelation.Ne sted = True
3.I then read the Xml document using ReadXml to load and create a DataSet.

Now to my question is this DataSet that was created from 3 the same DataSet
with the same structure
that existed when I wrote down using WriteXml using point 2 above.

//Tony
Aug 25 '08 #1
2 1690
"Tony Johansson" <jo************ *****@telia.com wrote in message
news:eu******** ******@TK2MSFTN GP02.phx.gbl...
Assume the following :
1. I create a DataSet with some DataRelation.
2. I then use WriteXml to write the DataSet to an Xml document using
DataRelation.Ne sted = True
3.I then read the Xml document using ReadXml to load and create a DataSet.

Now to my question is this DataSet that was created from 3 the same
DataSet
with the same structure
that existed when I wrote down using WriteXml using point 2 above.
In step 3 you will only be sure to get an accurate duplicate of the
schema of the original dataset if you use the "WriteSchem a" option when you
do the WriteXml in step 2:

myDataSet.Write Xml("file.xml", XmlWriteMode.Wr iteSchema);

This adds an xsd schema at the beginning of the written file, which can
then be used by ReadXml to reconstruct the original schema before loading
the data that follow. You can open the file with an editor to verify whether
the DataRelation does make its way into the schema (I believe it does).

Aug 25 '08 #2
On Aug 25, 8:02*am, "Tony Johansson" <johansson.ande rs...@telia.com >
wrote:
Hello!

Assume the following :
1. I create a DataSet with some DataRelation.
2. I then use WriteXml to write the DataSet to an Xml document using
DataRelation.Ne sted = True
3.I then read the Xml document using ReadXml to load and create a DataSet..

Now to my question is this DataSet that was created from 3 the same DataSet
with the same structure
that existed when I wrote down using WriteXml using point 2 above.

//Tony
IIRC you will have the exact same dataset. the only difference is how
the rows of the child table are created. If nested=true they are
embedded in the parent table.

honestly unless you will use the XML generated file in any other way I
would set nested to false
Aug 25 '08 #3

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

Similar topics

11
408
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the fastest? I don't think the ReadXMLSchema would give a lot of difference, but maybe the overlaods of ReadXml and WriteXml will. Especially with larges files/datatables... Should I use the IO.Stream? The XmlReader/XmlWriter?
4
1483
by: Brian Henry | last post by:
I have an XML file formated as this <?xml version="1.0" encoding="utf-8" ?> <settings> <databaseServer>Dell5100</databaseServer> <defaultDatabase>bene</defaultDatabase> </settings> relateively simple file... I want to be able to say which attribute of the settings group I want to read in a settings read function and return it...
0
264
by: John George | last post by:
I am writing the file correctly and it gives me the right xml file When I read it back, I am missing one element in the last row, it sets it to the initial value before I saved the origional file? Any ideas? Thanks, I am loading the xml file with this code; Dim myFileStream As New System.IO.FileStream _ (filename, System.IO.FileMode.Create) ' Create an XmlTextWriter with the fileStream. Dim myXmlWriter As New System.Xml.XmlTextWriter _
2
4821
by: C Glenn | last post by:
I'm attempting to use ReadXml. It's working in that I end up with some data in the DataSet. But I'm not able to deal with it effectively after that. The XML file is properly formatted in that it was created with WriteXML, so it contains the name of the table (I've inspected it to be sure). But after calling ReadXml the DataSet does not contain a table with the specified name. In fact, Tables does not contain a table corresponding to...
12
1430
by: dgk | last post by:
I'm planning on writing a fairly small app (VB2005) to be distributed via shareware that needs a single user database. I don't even think that SQL Server Express edition is needed since I think that it is essentially a true DB that runs all the time. I really need something like Access and was thinking about using it but there is so little documentation available on using Access from DotNet that I have to feel that it is not the answer....
0
1368
by: hazz | last post by:
I want to load Service.exe.config into a DataGrid, change the timer interval value from 10000 to 555555, then update the original exe.config. The code below shows the code at step 1 and 2 before creating ServiceNew.exe.config below. The initial line, '<?xml version="1.0" encoding="utf-8" ?' is missing and the nodes are not hiearchical with indentation from the root to the innermost nodes as the original config file. How can I add this...
1
2387
by: ray well | last post by:
i saved the state of a data set and table via MyDs.WriteXmlSchema("MyDs.xsd") MyDs.WriteXml("MyDs.xml") i was able to read them back in and display the info in the database by MyDs.ReadXmlSchema("MyDs.xsd") MyDs.ReadXml("MyDs.xml")
0
3281
by: =?Utf-8?B?bXJjc2hhcnBtYW4=?= | last post by:
Hello, There is a space(as a data) in one of the columns. And i save my DataTable as a xml file using DataSet. I used DataSet.WriteXml method to save as a xml file. Now if I read that .xml file using DataSet.ReadXml method,it removes space in that DataTable. Any idea...? This does not work in Visual Studio .NET 2003. If I execute this in VS .Net 2005, it works. I must make it work in VS 2003.
0
1175
by: Arto Viitanen | last post by:
I am using WriteXML/ReadXml pair to save DataSet for later use. DataSet is built by reading textfiles and storing their data to different DataTables. Each file contains several complex values, that are represented using a DataValue object. DataValue is an abstract class, that has subclasses that implement the value (for example; ValBlkValue represents a vector of floating values). Class DataValue implements IXmlSerializable interface and...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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,...
1
10320
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,...
0
9150
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
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();...
0
5521
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...
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.