467,919 Members | 1,235 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,919 developers. It's quick & easy.

Problem creating DataSet structure from xsd: The same table (...) cannot be the child table in two nested relations.

Suppose we have an object hierarchy in XSD.
For example, let us take Control, Label, TextBox and LinkLabel windows
Each control has some properties which are represented as elements.
Some of the elements are of complex types as well, like bounds - of type
(See full example in the bottom of the letter.)

DataSet.ReadXMLSchema fails to parse such XSD file.
The problem is caused by complex type as an element of the base type of
(In the example this type is called rectangle.)
More specifically, when parsing the example XSD file DataSet.ReadSchema
1. Create table for "allowedObject" complex type.
2. Create table named "label" for label complex type.
3. Create table "bounds" for bounds element of complex type "rectangle".
4. Create table "textBox" for textBox complex type.
5. Try to create "bounds" table for bounds element of complex type
"rectangle" and fail because this table already exists.

From my point of view is a serious restriction of functionality.
I am using Visual Studio 2002 and .NET Framework 1.0.
Is it fixed in Framework 1.1?

Can you think of a workaround for this problem?
Please do not suggest to inherit control from rectangle, because in real
schema I have more then one complex property.
I can add "font" to this example to illustrate it.

Thank you.
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd"
<xs:complexType name="rectangle">
<xs:element name="left" type="xs:int" />
<xs:element name="top" type="xs:int" />
<xs:element name="width" type="xs:int" />
<xs:element name="height" type="xs:int" />
<xs:complexType name="control">
<xs:element name="bounds" type="rectangle" />
<xs:element name="name" type="xs:string" />
<xs:element name="text" type="xs:string" />
<xs:complexType name="label">
<xs:extension base="control">
<xs:element name="preferedHeight" type="xs:int" />
<xs:element name="preferedWidth" type="xs:int" />
<xs:complexType name="linkLabel">
<xs:extension base="label">
<xs:element name="link" type="xs:string" />
<xs:complexType name="textBox">
<xs:extension base="control">
<xs:element name="maxLength" type="xs:int" />
<xs:complexType name="allowedObject">
<xs:element name="label" type="label" />
<xs:element name="textBox" type="textBox" />
<xs:element name="linkLabel" type="linkLabel" />
<xs:complexType name="resource">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="allowedObject" type="allowedObject" />
<xs:element name="MyDataSet" type="resource" msdata:IsDataSet="true" />
Nov 12 '05 #1
  • viewed: 4825

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Frosty | last post: by
4 posts views Thread by Jaga | last post: by
3 posts views Thread by Mauricio Correa L. | last post: by
8 posts views Thread by I am Sam | last post: by
reply views Thread by sparty1022 | last post: by
8 posts views Thread by BD | last post: by
4 posts views Thread by Matt F | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.