Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xml schema and derivation by restriction

Reply
Thread Tools

xml schema and derivation by restriction

 
 
hre1@lycos.de
Guest
Posts: n/a
 
      12-29-2004
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
 
Reply With Quote
 
 
 
 
Stan Kitsis [MSFT]
Guest
Posts: n/a
 
      12-29-2004
Jeff,

Your code violates the following constraint (Schema Component Constraint:
Particle Restriction OK (Elt:Elt -- NameAndTypeOK)):
http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xml schema and derivation by restriction hre1@lycos.de XML 3 01-07-2005 12:24 PM
xml schema and derivation by restriction hre1@lycos.de XML 1 12-29-2004 12:43 AM
portected access: template derivation vs. class derivation Steven T. Hatton C++ 12 08-20-2004 04:56 AM
Derivation by restriction and overriding the use property of an attribute Dietmar Gräbner XML 1 07-19-2004 11:45 AM
derivation, restriction, extension, ... Benjamin Michotte XML 1 09-05-2003 09:47 AM



Advertisments