[quoted text, click to view] "Michael Kuzminski" <MichaelKuzminski@discussions.microsoft.com> wrote in message
news:B16E643A-9A9D-4F89-B597-DCD9A9E5EED4@microsoft.com...
> The xml is valid, but ADO.net complains when I try to load
> it into a dataset. It gives me the error:
> The same table (Table name) cannot be the child table in two nested
> relations.
The error is correct because the XML isn't structured in a manner
allowing ADO.NET to infer how it should be represented within
a DataSet.
[quoted text, click to view] > Microsoft has a knowledge base article about this, but doesn't say how to
> resolve it. kb article
>
http://support.microsoft.com/default.aspx?scid=kb;en-us;325696 One solution would take this structure to provide foreign keys relating
Order and Inventory each to an ItemDetail, like this (omitted are any
ADO.NET's metadata attributes, essentially create the non-nested
relationships manually),
- - - normal.xml
<?xml version="1.0" ?>
<OrdersInventoryData>
<Order>
<ItemDetailNo>1</ItemDetailNo>
</Order>
<Inventory>
<ItemDetailNo>2</ItemDetailNo>
</Inventory>
<ItemDetail>
<detailno>1</detailno>
<id>1</id>
<qty>5</qty>
</ItemDetail>
<ItemDetail>
<detailno>2</detailno>
<id>1</id>
<qty>100</qty>
</ItemDetail>
</OrdersInventoryData>
- - -
[quoted text, click to view] > I need to be able to load up this xml in a dataset for
> display purposes. Does anyone have any idea how to acomplish this?
All solutions involve adapting your XML into something DataSet
finds palatable, whether manually, by XSLT, by XmlReader filter,
or in some other way.
Use XmlDocument if you need to import well-formed, but not
necessarily relationally-structured XML. If necessary, implement
an IBindingList wrapper around your XmlDocument so you can
data-bind to it.