You should take a look at Obtaining a Relational DataSet from an XML Schema (XSD) . This article indicates that
In the general case, for each child element of the complexType of a schema element, a table is created in the DataSet. The structure of the table is determined by the definition of a complex type.
...
However, the table is only created for the top-level complexType element when the complexType element is nested inside another complexType element, in which case the nested complexType element is mapped to the DataTable in the DataSet.
So basically in this case ReadXML(...) will create two tables
As the Item complexType is located , nested in the Order complexType , a relationship will also be created between the two tables. To create this relationship, a new Order_id column will be included.
EDIT
Take a look at Creating DataSet Relationships for XSD . In this article you will find the following:
msdata: Relationship annotation allows you to explicitly specify relationships between parents and children between elements in a schema that are not nested. The following example shows the relationship structure of an element.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="Order"> ... your definition goes here! </xs:element> <xs:annotation> <xs:appinfo> <msdata:Relationship name="OrderItemRelation" msdata:parent="Order" msdata:child="Item" msdata:parentkey="OrderID" msdata:childkey="ANY_COLUMN_IN_NESTED_COMPLEX_TYPE"/> </xs:appinfo> </xs:annotation> </xs:schema>
So, you can change which column will be used to refer to the internal to the external complexType, but you cannot prevent this functionality !
source share