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

Question about dataset readxml method

Hi,

I am using Dataset's ReadXML method to read an XML file. Here i s my code
snippet:

Dim dsTemp As New DataSet
dsTemp.ReadXml(Server.MapPath("~/data3.xml"))

and data3.xml as follow:
<myDataSet>
<LeftMenu>
<MenuItem>
<Title>Enter Customer</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter Contact</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter City</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter City</Title>
<Action>Sid</Action>
</MenuItem>
</LeftMenu>
</myDataSet>
After readXML statement, dsTemp.tables.count is 2, I am expecting only 1.
The one that has all XML content is dsTemp.tables(1), can any one explain
why there is another table?

TIA

Nov 19 '05 #1
1 1247
Rak
Hi Ray,
This is exactly how the parsing happens in dataset.ReadXML method. Each
node with children will be added as a table to the dataset. So in your case
LeftMenu will be added as a table and then MenuItem table. If you check the
relationship (ds.Relations) you will find a parent-child relationship between
these two tables.

Hope this helps.

rgds,
Rakesh

"Raymond Du" wrote:
Hi,

I am using Dataset's ReadXML method to read an XML file. Here i s my code
snippet:

Dim dsTemp As New DataSet
dsTemp.ReadXml(Server.MapPath("~/data3.xml"))

and data3.xml as follow:
<myDataSet>
<LeftMenu>
<MenuItem>
<Title>Enter Customer</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter Contact</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter City</Title>
<Action>Sid</Action>
</MenuItem>
<MenuItem>
<Title>Enter City</Title>
<Action>Sid</Action>
</MenuItem>
</LeftMenu>
</myDataSet>
After readXML statement, dsTemp.tables.count is 2, I am expecting only 1.
The one that has all XML content is dsTemp.tables(1), can any one explain
why there is another table?

TIA

Nov 19 '05 #2

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

Similar topics

1
by: Jeffrey A. Voigt | last post by:
I'm having trouble loading some xml data into a dataset via the ReadXML call. I'm loading into the dataset an xml schema prior to the ReadXML call. I see that there IS in fact, 3 records that...
1
by: Andy | last post by:
Hello, I have a WebService that sends a client a DataSet as XML (I use a DataSet.GetXml to get the XML). The DataSet is filled by a DataAdapter in the WebService. The client coverts the XML Back...
3
by: Dev | last post by:
Good Morning to all, I have a bunch of XML files that need to be readed inside the same DataSet (each XML represent a single table). In the event of a large (some megabytes) file, what is the...
1
by: kids_pro | last post by:
I had come across a code block from Loading a DataSet from XML (.NET Framework Developer's Guide) ---------------------------------------- NOte If you call ReadXML to load a very large file, you...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
2
by: Walt | last post by:
I have a small xml document that I bring into my application by reading the xml file with a dataset: Dim ds As New DataSet ds.ReadXml(fileName) ' Do some work with the tables in the dataset...
4
by: J.C.Rivera | last post by:
Hello... I'm a rookie to c#. So let me see if i can expose properly my situation. I developed a stored procedure in sql server 2000 that allows me to construct my dataset in XML format. the...
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...
4
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a DataSet that I save as XML using the DataSet DataTable's WriteXml method. If I say XmlWriteMode.IgnoreSchema, it shows up great in Excel, but I can not reopen the file in my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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,...

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.