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

Cannot set a nested table name to the same name when converting XML to DataSet

I have been given XML similar to the below. In this example, Bob manages
Sue, Dan manages Ron, and Mac manages Amy.

I tried importing the XML into a DataSet using this code:

XmlDataDocument WebsiteXmlDataDocument = new XmlDataDocument();
WebsiteXmlDataDocument.DataSet.ReadXml(new
StreamReader(Request.PhysicalApplicationPath + @"\Employees.xml"),
XmlReadMode.InferSchema);

.... but get this error:

A column named 'Employees' already belongs to this DataTable: cannot set a
nested table name to the same name.

How can I remedy?

Thanks for any help.
<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee>
<EmployeeId>c2e515e9-8feb-4bb5-b6de-3642e3f7157f</EmployeeId>
<EmployeeName>Bob</EmployeeName>
<Employees>
<Employee>
<EmployeeId>ba3f80be-78a0-499f-92db-4a87843654e1</EmployeeId>
<EmployeeName>Sue</EmployeeName>
<Employees />
</Employee>
</Employees>
</Employee>
<Employee>
<EmployeeId>535fdfa3-5118-45e6-9596-d2a8e8521e6c</EmployeeId>
<EmployeeName>Dan</EmployeeName>
<Employees>
<Employee>
<EmployeeId>e5f2b56f-3b91-4254-b827-5164288457b4</EmployeeId>
<EmployeeName>Ron</EmployeeName>
<Employees />
</Employee>
</Employees>
</Employee>
<Employee>
<EmployeeId>88a0819e-8990-4454-b35e-22fd08f95ed5</EmployeeId>
<EmployeeName>Mac</EmployeeName>
<Employees>
<Employee>
<EmployeeId>a5d2144b-ef41-441a-9ce3-11d3bc651b89</EmployeeId>
<EmployeeName>Amy</EmployeeName>
<Employees />
</Employee>
</Employees>
</Employee>
</Employees>

Aug 6 '08 #1
0 1267

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

Similar topics

1
by: tom | last post by:
hello, i have seen multiple postings on the subject but no answer that addresses my question: I create a dataset using a xsd schema. the schema specifies a relation from one of the tables to...
0
by: Max | last post by:
Suppose we have an object hierarchy in XSD. For example, let us take Control, Label, TextBox and LinkLabel windows controls. Each control has some properties which are represented as elements....
4
by: Alfetta159 | last post by:
I've been setting up a schema with the XML Designer in VS .NET 2003. The designer lets me set up a lot of things including a complex type that contains an unnamed complex type called modified. ...
3
by: sam | last post by:
i get the following error while reading an xml into a dataset The same table cannot be the child table in two nested relation is there a solution for it
1
by: Benny Raymond | last post by:
I have a dataset setup with a main table that has some information in it along with an element that is a nested table so that I can store rows of history information for that one row in the main...
4
by: Steve Klett | last post by:
(I posted this in ADO group, but I think this group will be better) Hi- I need to develop an FAQ section for our website. We would like to break up the FAQ by products, then categories with...
1
by: Random | last post by:
I don't understand why this error is happening when I try to load my xml into my DataSet. "Cannot add a nested relation or an element column to a table containing a SimpleContent column." Can...
1
by: Thu | last post by:
Hi, I create a Dataset to link three tables in my Access database. E.g. The three tables are , , . I then create 2 DataRelations, 1st relation (Order_Cust_Rel) links and using CustomerID field...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
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: 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: 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
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...

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.