RE: Explanation of xs:restriction and xs:extension

Hello Jochen,

this is good:
http://www.zvon.org/xxl/XMLSchemaTutorial/Output/highlights.html

Harald

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




Hi,

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
    "particle".

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

    - 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
    silently?

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.
    Right?


Kind regards,

Jochen



  <xs:complexType name="group" abstract="true">
    <xs:complexContent>
      <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:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="realGroup">
    <xs:complexContent>
      <xs:restriction base="xs:group">
        <xs:sequence>
          <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:choice>
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="groupRef">
     <xs:complexContent>
       <xs:restriction base="xs:realGroup">
         <xs:sequence>
           <xs:element ref="xs:annotation" minOccurs="0"/>
         </xs:sequence>
         <xs:attribute name="ref" use="required" type="xs:QName"/>
         <xs:attribute name="name" use="prohibited"/>
       </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

Received on Friday, 2 May 2003 02:28:01 UTC