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

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.Nested = 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 1657
"Tony Johansson" <jo*****************@telia.comwrote in message
news:eu**************@TK2MSFTNGP02.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.Nested = 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 "WriteSchema" option when you
do the WriteXml in step 2:

myDataSet.WriteXml("file.xml", XmlWriteMode.WriteSchema);

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.anders...@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.Nested = 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
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...
4
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> ...
0
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?...
2
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...
12
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...
0
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...
1
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 ...
0
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...
0
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...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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...

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.