The same table <choice> cannot be the child table in two nested relations

I have a xml file generated by third party. I need to display the content on datagrid to let user modify and write back to the xml file. Usually I create a dataset and read the xml into it. But this xml file is different from those i have worked on before which it gives me such error message as in the subject. What should I do?

[370 byte] By [nraf] at [2008-1-12]
# 1
Hi nraf,

See if the KB below applies to ur situation:
http://support.microsoft.com/default.aspx?scid=kb;en-us;325695

Regards,
Vikram

Vikram at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 2
Vikram,

I have a similar problem to nraf, but the KB referenced is not relevant in my case. I have a schema that gives this error when I read it into VS 2003 and try to make a strongly typed data set out of it. I was told this was fixed in VS2005. And with VS2005, I am able to generate a valid .vb file using the XSD tool. But at runtime, when I try to new the strongly typed dataset based on this schema I get the error message listed here - that the same table can not be the child of two nested relations.

This is one of several schemas produced by the same vendor that illustrate the same behavior. The schemas are valid accourding to XMLSpy and XML tools. If these can not be processed correctly by VS2005, I have a big problem on my hands. Any suggestions would be greatly appreciated.

Vicki

VickiV at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 3
Did you come up with a solution Vicki?
I'm having exactly the same problem as you describe.

Regards

Neil

NeilMcLaughlin at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 4
The DataSet class in .NET 2.0 (Visual Studio 2005) still has the limitation of not supporting different nested tables with the same name. Therefore you will have to introduce an XML transform to pre-process the XML (and schemas) before you load them up into the DataSet.
ChrisLovett at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 5

This problem/issue affects several industry standard schemas utilized by the manufacturing industry.

see http://www.wbf.org/associations/2718/files/B2MML-V03.zip

These schemas are produced by WBF (World Batch Forum) as an implementation of ISA S95 standard for defining Enterprise-Control System integration. It is becoming the accepted standard for implementing such integration. Obviously, there are benefits to being able to utilize these schemas as strongly typed DataSets and define interfaces around them for parameters and return values so that the types can be validated at compile time vs. having custom code to do parameter validation on a more generic type such as DataSet or Stream.

Sincerely,

Nick Miller

GE Fanuc Automation

NickMiller at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 6

My problem is during the instanciation of the typed dataset not during the load of the xml.

Now, we will have to use the System.Xml API and XPath expressions to explore the xml stream.

I am really disappointed about the framework .net 2.0 and visual studio 2005 i was expecting that they will fix the problem but nothing. I think that is incredible that the generator create the dataset successfully but during the run-time we can not use it. That means that the solution is almost there, but we have to wait...

Johnny KNOBLAUCH

JohnnyKNOBLAUCH at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 7

If you can vote for feed back this bug to microsoft.

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=0cb275c6-0bc9-4dda-9f6c-ce48a9a4c1b6

It will be nice!

Thanks !

Johnny KNOBLAUCH

JohnnyKNOBLAUCH at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 8

This is actuly good idea to provide feadback and requiest about features.

The more support the feature has more chances it will be fixed/improved.

SergeyDubinets at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 9

I need some help.

This is the output file from ADModify.Net to dump the Exchange 2003 User Rights. I am trying to load this into a .Net DataSet but I get that famous error. The same table <Entry> cannot be the child table in two nested relations

Here is my question, how do I delete remove purge the Inherited node completely? I don't need it.

It is the node cause this problem.

Thanks in advance for any help.

Robert

<MailboxRights>
<user UserDN="LDAP://CN=Doe\, Jane,OU=Users,OU=Region1,DC=xx,DC=xx,DC=xx,DC=xx">
<Inherited>
<Entry Trustee="OFFICE\R2AdminAD" Mask="ACE_MB_FULL_ACCESS|Denied ACE_MB_DELETE_MB_STORAGE|Denied ACE_MB_READ_PERMISSIONS|Denied ACE_MB_CHANGE_PERMISSION|Denied ACE_MB_TAKE_OWNERSHIP|Denied " />
<Entry Trustee="OFFICE\R3AdminAD" Mask="ACE_MB_FULL_ACCESS|Denied ACE_MB_DELETE_MB_STORAGE|Denied ACE_MB_READ_PERMISSIONS|Denied ACE_MB_CHANGE_PERMISSION|Denied ACE_MB_TAKE_OWNERSHIP|Denied " />
<Entry Trustee="OFFICE\R4AdminAD" Mask="ACE_MB_FULL_ACCESS|Denied ACE_MB_DELETE_MB_STORAGE|Denied ACE_MB_READ_PERMISSIONS|Denied ACE_MB_CHANGE_PERMISSION|Denied ACE_MB_TAKE_OWNERSHIP|Denied " />
<Entry Trustee="OFFICE\R5AdminAD" Mask="ACE_MB_FULL_ACCESS|Denied ACE_MB_DELETE_MB_STORAGE|Denied ACE_MB_READ_PERMISSIONS|Denied ACE_MB_CHANGE_PERMISSION|Denied ACE_MB_TAKE_OWNERSHIP|Denied " />
<Entry Trustee="OFFICE\R1AdminAD" Mask="ACE_MB_FULL_ACCESS|Allowed ACE_MB_DELETE_MB_STORAGE|Allowed ACE_MB_READ_PERMISSIONS|Allowed ACE_MB_CHANGE_PERMISSION|Allowed ACE_MB_TAKE_OWNERSHIP|Allowed " />
</Inherited>
<NotInherited><Entry Trustee="REGION_1\H12345" Mask="ACE_MB_FULL_ACCESS|Allowed ACE_MB_ASSOC_EXT_ACCT|Allowed ACE_MB_READ_PERMISSIONS|Allowed " />
</NotInherited>
</user>
</MailboxRights>

RobertMcDaniel at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 10

The above document states that bug has been fixed as part of VS2005 SP1, but I still get the same error when instantiating my strongly-typed dataset...

Does anyone have any additional information on the following?

LeoH at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 11

Leo, I have the same issue, I have installed the patch for VS 2005, and the designer shows the DataSet, but when I go to add the DataSet to a form, by drag and drop I get that error: The same table <choice> cannot be the child table in two nested relations

Did you find the fix? They say it is fixed.

Howard at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 12

I ended up not using this method at all.

Instead, I created classes that matched the Xml document schema, and the .Net framework takes care of serializing/deserializing to/from Xml automatically if you apply the Xml attributes to your classes correctly.

Check out the following code which shows deserializing the xml stream, not sure if it will be of help to anyone reading.

Code Snippet

/// <summary>

/// Utility that that deserializes a UTF8 formatted string into a class instance

/// </summary>

/// <typeparam name="T">Runtime Type to return as deserialization</typeparam>

internal sealed class DeSerializeUtility<T>

{

/// <summary>

/// Processes string and returns deserialized object

/// </summary>

/// <param name="psXMLString">Xml Data</param>

/// <returns>Deserialized object</returns>

public T DeSerialize(string psXMLString)

{

XmlSerializer xs = new XmlSerializer(typeof(T));

MemoryStream memoryStream = new MemoryStream(this.StringToUTF8ByteArray(psXMLString));

XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);

return (T)xs.Deserialize(memoryStream);

}

/// <summary>

/// Converts UTF8 formatted string into a binary representation

/// </summary>

/// <param name="psXmlString">Xml data</param>

/// <returns>Binary representation of data</returns>

private Byte[] StringToUTF8ByteArray(string psXmlString)

{

UTF8Encoding encoding = new UTF8Encoding();

Byte[] byteArray = encoding.GetBytes(psXmlString);

return byteArray;

}

}

LeoH at 2007-8-21 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified