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

Article translations Article translations
Article ID: 325696 - View products that this article applies to.
This article was previously published under Q325696
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SYMPTOMS

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.

CAUSE

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.

STATUS

This behavior is by design.

MORE INFORMATION

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.

REFERENCES

For more information about ADO.NET schema inference rules, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/en-us/library/aa720672.aspx

Properties

Article ID: 325696 - Last Review: February 27, 2014 - Revision: 4.7
APPLIES TO
  • 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
Keywords: 
kbnosurvey kbarchive kbtshoot kbprb kbnofix KB325696

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com