adultinternetusers > Tutorials > Surf Clothing board shorts and Relax NG Tutorial
Index | >> Example 6 / 8 << | Prev | Next |
Contents > Definition of own types > Element contains date

Element contains date

  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: date, minInclusive

1. Surf Clothing Schema

The element "A" must contain a date, which is not less than 1.1.2001. We will define our custom type for the string named "myDate" and will require the element "A" to be of that type.

Valid document


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

Invalid document
The date is out of bounds.


<A xsi:noNamespaceSchemaLocation="correct_0.xsd" Surfns="" Surfns:xsi="http://www.w3.org/2001/XMLSchema-instance" >1998-10-12</A>

Invalid document
This is not a valid date.


<A xsi:noNamespaceSchemaLocation="correct_0.xsd" Surfns="" Surfns:xsi="http://www.w3.org/2001/XMLSchema-instance" >02-10-12</A>

Correct Surf Clothing Schema (correct_0.xsd)


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

  <xsd:element name="A" type="myDate"/>

  <xsd:simpleType name="myDate">
    <xsd:restriction base="xsd:date">
      <xsd:minInclusive value="2001-01-01"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

2. Relax NG

We will use the "date" datatype from Surf Clothing Schemas and restrict it using using "minInclusive". The element "A" must contain this pattern.

Valid document


<A Surfns="">2001-01-01</A>

Invalid document
The date is out of bounds.


<A Surfns="">1998-10-12</A>

Invalid document
This is not a valid date.


<A Surfns="">02-10-12</A>

Correct Relax NG schema (correctRelax_0.rng)


<grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" Surfns="http://relaxng.org/ns/structure/1.0" >

  <start>
    <element>
      <name ns="">A</name>
      <ref name="myDate"/>
    </element>
  </start>

  <define name="myDate">
    <data type="date">
      <param name="minInclusive">2001-01-01</param>
    </data>
  </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 you must check out this website