You receive an error message when you view multidimensional XML data in the Visual Studio .NET XML Designer

This article was previously published under Q325696
This article has been archived. It is offered "as is" and will no longer be updated.
Valid XML documents that contain multidimensional data cannot be displayed in the Data view of the Microsoft Visual Studio .NET XML Designer.

Note An example of multidimensional data is a single table that participates in more than one parent-child relationship.

When you try to switch to Data view, you receive the following error message on the Data tab of the XML Designer:
Although this XML document is well formed, it contains structure that Data view cannot display.
The same table (Table name) cannot be the child table in two nested relations.
When the Visual Studio .NET XML Designer tries to generate the Data view of an XML document, the XML Designer applies the Microsoft ADO.NET schema inference rules to determine the schema information for the source XML. The ADO.NET schema inference rules in the original release version of the Microsoft .NET Framework do not permit a single table to be a child table in more than one DataRelation object.

According to ADO.NET schema inference rules, elements that have child elements are inferred as tables. In the example in the "Steps to reproduce the behavior" section, the Order element, the Item element, and the Inventory element all have child elements. Therefore, all these elements are inferred as individual DataTable objects.

If elements are inferred as tables, and these tables are nested in other elements that are also inferred as tables, a nested DataRelation is created between the two tables. Therefore, the Item DataTable is also inferred as participating in two parent-child relationships, the Order-Item relationship and the Inventory-Item relationship.

This behavior causes the XML data to be not valid according to the ADO.NET schema inference rules. Therefore, the XML Designer cannot display the data.
This behavior is by design.

Steps to reproduce the behavior

  1. In a text editor such as Notepad, paste the following XML data, and then save the file as C:\OrdersInv.xml.
    <?xml version="1.0" ?><OrdersInventoryData>	<Order>		<Item>			<id>1</id>			<qty>5</qty>		</Item>	</Order>	<Inventory>		<Item>			<id>1</id>			<qty>100</qty>		</Item>	</Inventory></OrdersInventoryData>					
  2. In Visual Studio .NET, open the C:\OrdersInv.xml file. The XML file opens in the XML Designer.
  3. Click the Data tab to view the XML data in Grid format. Notice that the XML Designer is not available, and you receive the error message that is mentioned in the "Symptoms" section.
For more information about ADO.NET schema inference rules, visit the following Microsoft Developer Network (MSDN) Web site:

Article ID: 325696 - Last Review: 02/27/2014 21:14:04 - Revision: 4.7

Microsoft Visual Studio .NET 2003 Enterprise Architect, Microsoft Visual Studio .NET 2003 Enterprise Developer, Microsoft Visual Studio .NET 2003 Academic Edition, Microsoft Visual Studio .NET 2002 Professional Edition, Microsoft Visual Studio .NET 2002 Enterprise Architect, Microsoft Visual Studio .NET 2002 Enterprise Developer, Microsoft Visual Studio .NET 2002 Academic Edition

  • kbnosurvey kbarchive kbtshoot kbprb kbnofix KB325696