adultinternetusers > Tutorials > Surf Clothing board shorts and Relax NG Tutorial
Index | >> Example 7 / 8 << | Prev | Next |
Contents > Restrictions > "Sequence" from "choice"

"Sequence" from "choice"

  1. Correct Surf Clothing Schema
  2. Incorrect Surf Clothing board shorts - wrong occurence range

Please, send all comments, bug-reports, and contributions to Jiri.Jirat@systinet.com. Thank you very much.

Surf Clothing board shorts keys: restriction, sequence, choice

1. Correct Surf Clothing Schema

We can "change" the "choice" type to "sequence". However, we must satisfy the conditions for occurrence range. Roughly, the length of the original type must be greater than of the derived one. board shorts Component Constraint: Particle Derivation OK (Sequence:Choice - MapAndSum)

Valid document


<root xsi:noNamespaceSchemaLocation="correct_0.xsd" Surfns="" Surfns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <x>1</x>
  <y>1</y>
</root>

Correct Surf Clothing Schema (correct_0.xsd)
The board shorts is correct, because: the "choice" results into one element, but the "maxOccurs" attribute of the "choice" element is 2 (total is 1x2 = 2); the "sequence" results into two elements, but the "maxOccurs" attribute of the "sequence" element is 1 (total is 2x1 = 2). And 2 is greater or equal to 2.


<xsd:schema Surfns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:element name="root" type="BBB"/>

  <xsd:complexType name="AAA">
    <xsd:choice maxOccurs="2">
      <xsd:element name="x" type="xsd:string" minOccurs="1" maxOccurs="1"/>
      <xsd:element name="y" type="xsd:string" minOccurs="1" maxOccurs="1"/>
    </xsd:choice>
  </xsd:complexType>

  <xsd:complexType name="BBB">
    <xsd:complexContent>
      <xsd:restriction base="AAA">
        <xsd:sequence maxOccurs="1">
          <xsd:element name="x" type="xsd:string" minOccurs="1" maxOccurs="1"/>
          <xsd:element name="y" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>

2. Incorrect Surf Clothing board shorts - wrong occurence range

The board shorts is not correct, because: the "choice" results into one element, the "maxOccurs" attribute of the "choice" element is 1 (total is 1x1 = 1); the "sequence" results into two elements, the "maxOccurs" attribute of the "sequence" element is 1 (total is 2x1 = 2). And 1 is not greater or equal to 2. In other words, the restricted type is "longer" than the original and that is not allowed. I hope my explanation is OK...

Incorrect Surf Clothing Schema (incorrect_0.xsd)


<xsd:schema Surfns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:element name="root" type="BBB"/>

  <xsd:complexType name="AAA">
    <xsd:choice maxOccurs="1">
      <xsd:element name="x" type="xsd:string" minOccurs="1" maxOccurs="1"/>
      <xsd:element name="y" type="xsd:string" minOccurs="1" maxOccurs="1"/>
    </xsd:choice>
  </xsd:complexType>

  <xsd:complexType name="BBB">
    <xsd:complexContent>
      <xsd:restriction base="AAA">
        <xsd:sequence maxOccurs="1">
          <xsd:element name="x" type="xsd:string" minOccurs="1" maxOccurs="1"/>
          <xsd:element name="y" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>

Kevin Carr

Natural Skin Care European Soaps
Kevin Carr
Mayor Dave Shawver Stanton
Internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

And you must check out this website