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

RE: Explanation of xs:restriction and xs:extension

From: Lemmin, Harald <Harald.Lemmin@softwareag.com>
Date: Fri, 2 May 2003 08:27:52 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210606E34C2A@daemsg02.software-ag.de>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hello Jochen,

this is good:


-----Original Message-----
From: Jochen Wiedmann [mailto:joe@ispsoft.de]
Sent: Donnerstag, 1. Mai 2003 18:39
To: xmlschema-dev@w3.org
Subject: Explanation of xs:restriction and xs:extension


can anyone point me to a more readable explanation of
xs:restriction and xs:extension in complex elements?
I really do not understand the specification. In particular
I would like to have answers to the following questions:

Suggest the following groups "group", "realgroup", and
"groupRef" from XML schema. (See below.)

1.) The group "group" uses a group ("particle") as the content
    model. The "realGroup" has a "choice" with some elements from

    - Does the "choice" from "realGroup" need to match the "choice"
      of particle? Or would it be possible to use a "sequence" in

    - Obviously the relation between the elements in "realGroup" and
      the elements in "particle" is by name. Is the relation always
      by name? If so, are there other possible relations, for example,
      by order? Are the element names unique? In other words, can I
      restrict a type with the content model "either a, followed by b,
      or c, followed by b"? (Note that the element name b is not unique.)

2.) The group "group" is extending "xs:annotated". The latter specifies
    an element "id". The attribute "id" from "xs:annotated" isn't
    mentioned. However, a group may surely have an ID. In other words:
    An attribute which is missing in the restriction, is inherited

3.) As a conclusion: The group "realGroup" has the same attributes
    than "group": "ref", "name", "minOccurs", and "maxOccurs". But
    "groupRef" requires "ref" and must not have "name" attribute.

Kind regards,


  <xs:complexType name="group" abstract="true">
      <xs:extension base="xs:annotated">
        <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
        <xs:attributeGroup ref="xs:defRef">
        <xs:attributeGroup ref="xs:occurs">

  <xs:complexType name="realGroup">
      <xs:restriction base="xs:group">
          <xs:element ref="xs:annotation" minOccurs="0"/>
          <xs:choice minOccurs="0" maxOccurs="1">
            <xs:element ref="xs:all"/>
            <xs:element ref="xs:choice"/>
            <xs:element ref="xs:sequence"/>

  <xs:complexType name="groupRef">
       <xs:restriction base="xs:realGroup">
           <xs:element ref="xs:annotation" minOccurs="0"/>
         <xs:attribute name="ref" use="required" type="xs:QName"/>
         <xs:attribute name="name" use="prohibited"/>
Received on Friday, 2 May 2003 02:28:01 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:01 UTC