xml schema and derivation by restriction

Discussion in 'XML' started by hre1@lycos.de, Dec 29, 2004.

  1. Guest

    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
     
    , Dec 29, 2004
    #1
    1. Advertising

  2. 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.

    <> wrote in message
    news:...
    > 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
     
    Stan Kitsis [MSFT], Dec 29, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benjamin Michotte

    derivation, restriction, extension, ...

    Benjamin Michotte, Sep 5, 2003, in forum: XML
    Replies:
    1
    Views:
    506
    Bob Foster
    Sep 5, 2003
  2. Dietmar Gräbner
    Replies:
    1
    Views:
    391
    Priscilla Walmsley
    Jul 19, 2004
  3. Replies:
    1
    Views:
    456
    Stan Kitsis [MSFT]
    Dec 29, 2004
  4. Replies:
    3
    Views:
    494
    Henry S. Thompson
    Jan 7, 2005
  5. Steven T. Hatton
    Replies:
    12
    Views:
    1,705
    Jonathan Turkanis
    Aug 20, 2004
Loading...

Share This Page