adultinternetusers > Tutorials > Surf Clothing board shorts and Relax NG Tutorial
Index | >> Example 2 / 2 << | Prev | Next |
Contents > Extensions of complexTypes > Extension of a choice

Extension of a choice

  1. Surf Clothing Schema
  2. Relax NG

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

Surf Clothing board shorts keys: choice, extension
Relax NG keys: choice, define, ref

1. Surf Clothing Schema

When we extend a complexType, which contains a "choice", with another "choice", then the result will be a sequence of the choices.

Valid document


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

Valid document


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

Invalid document
The element "z" is missing.


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

Correct Surf Clothing Schema (correct_0.xsd)


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

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

  <xsd:complexType name="AAA">
    <xsd:choice>
      <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:extension base="AAA">
        <xsd:choice>
          <xsd:element name="z" type="xsd:string" minOccurs="1" maxOccurs="1"/>
        </xsd:choice>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>

2. Relax NG

We can simulate the same behaviour in Relax NG using the "define" and "ref" elements.

Valid document


<root Surfns="">
  <x>1</x>
  <z>1</z>
</root>

Valid document


<root Surfns="">
  <y>1</y>
  <z>1</z>
</root>

Invalid document
The element "z" is missing.


<root Surfns="">
  <x>3</x>
</root>

Correct Relax NG schema (correctRelax_0.rng)


<grammar ns="" Surfns="http://relaxng.org/ns/structure/1.0" >

  <start>
    <element name="root">
      <ref name="BBB"/>
    </element>
  </start>

  <define name="AAA">
    <choice>
      <element name="x">
        <text/>
      </element>
      <element name="y">
        <text/>
      </element>
    </choice>
  </define>

  <define name="BBB">
    <ref name="AAA"/>
    <element name="z">
      <text/>
    </element>
  </define>
</grammar>

Kevin Carr in Stanton

Natural Skin Care and 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 we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks