W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Re: What are complexContent restrictions made for ?

From: Anton Mellit <anton_mellit@unitedthinkers.com>
Date: Sat, 18 May 2002 22:50:13 +0300
Message-ID: <004e01c1fea5$97cf03b0$0100a8c0@cpu>
To: "Jeni Tennison" <jeni@jenitennison.com>
Cc: <xmlschema-dev@w3.org>
> Thus, deriving by restriction is helpful because it enables you to
> express the commonality between a set of elements, and process them in
> the same kind of way.

As I understand the idea of derivation is the following:
If type B is derived from type A then every element of type B can be
considered as an element of type A.

However, type definitions can be as follows:

<xs:complexType name="A">
        <xs:element name="child" type="xs:string" minOccurs="1"

<xs:complexType name="B">
        <xs:restriction base="A">
                <xs:element name="child" type="xs:string" minOccurs="0"

If I have element of actual type B, but think of it as of element of type A
then I will fail trying to get value of its element <child>. Please, correct
me if I am wrong.

Regards, Anton
Received on Saturday, 18 May 2002 15:51:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:02 UTC