xml schema and derivation by restriction

hre1

Usenet Archive
Joined
Dec 28, 2004
Messages
3
Reaction score
0
hello stan,

thank you very much for your fast replay! your solution will help to solve my problem. but i try to understand !why! sqc and xmlspy produce this messages:

SQC means:TYPE REFINEMENT ERROR (content type incompatible with the content type of the basetype)

and

XML Spy 2005 SP1 says: the content model of complex type ct_2 is not a valid restriction of the content model of ct_1

can you enlight me?

best regards
jeff

#############################################################################

Jeff,

The following will solve your problem. I created complex types for a1, a2, and a3 and referenced them within ct_1 and ct_2.

<xs:complexType name="a1">
<xs:sequence>
<xs:element name="b1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="a2">
<xs:sequence>
<xs:element name="b2"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="a3">
<xs:sequence>
<xs:element name="b3"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="ct_1">
<xs:sequence>
<xs:element name="a1" type="a1" />
<xs:element name="a2" type ="a2" minOccurs="0" />
<xs:element name="a3" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ct_2">
<xs:complexContent>
<xs:restriction base="ct_1">
<xs:sequence>
<xs:element name="a1" type="a1" />
<xs:element name="a2" type="a2" />
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

#############################################################################

hallo,

after numerous hours of searching for an explanation, i'm deadlocked.
here is my xsd:

<xs:complexType name="ct_1">
<xs:sequence>
<xs:element name="a1">
<xs:complexType>
<xs:sequence>
<xs:element name="b1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="a2" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="b2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="a3" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="b3"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ct_2">
<xs:complexContent>
<xs:restriction base="ct_1">
<xs:sequence>
<xs:element name="a1">
<xs:complexType>
<xs:sequence>
<xs:element name="b1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="a2" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="b2"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>

SCO means:TYPE REFINEMENT ERROR (content type incompatible with the content type of the basetype)

and

XML Spy 2005 SP1 says: the content model of complex type ct_2 is not a valid restriction of the content model of ct_1

but why? can anybody enlight me?

thanks in advance
jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top