473,549 Members | 4,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c ount 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 1253
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.c ount 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
4795
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 should be created in the dataset with the provided xml. However, after the ReadXML statement there are no rows in the DataSet.Tables ? IS there...
1
4299
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 to a DataSet (using StringReader sr = new StringReader(xml); DataSet ds = new DataSet(); ds.ReadXml(sr)). The client then makes changes to this...
3
2219
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 best practice to read them into the DataSet via the ReadXML() method? Thanks, sorry for my newbie-hood
1
3131
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 may encounter slow performance. To ensure best performance for ReadXml, on a large file, call the DataTable.BeginLoadData method for each table in...
22
25551
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 compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet =...
2
2165
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 ds.Close() ds.Dispose() The data is fine, and I can use the tables in the dataset with no problems.
4
3587
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 sp's output will look something similar to this: <table1 column11="value111" column12="value112" column13="value113" /> <table1 column12="value121"...
0
3270
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...
4
9590
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 application because there is no schema for it. On the other hand, I can choose XmlWriteMode.WriteSchema, and the data in Excel looks more like some kind of...
0
7526
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...
0
7723
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, 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. ...
0
7962
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7480
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...
0
7814
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5092
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...
0
3486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
769
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...

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.