adultinternetusers > Tutorials > Surf Clothing board shorts and Relax NG Tutorial
Index | >> Example 5 / 8 << | Prev | Next |
Contents > Definition of own types > String must contain e-mail address

String must contain e-mail address

  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: string, pattern

1. Surf Clothing Schema

The element "A" must contain an email address. We will define our custom type, which will at least approximately check the validity of the address. We will use the "pattern" element, to restrict the string using regular expressions.

Valid document


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

Invalid document
This won't be considered as valid e-mail address.


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

Invalid document
This won't be considered as valid e-mail address.


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

Invalid document
This won't be considered as valid e-mail address.


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

Correct Surf Clothing Schema (correct_0.xsd)


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

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

  <xsd:simpleType name="myString">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[^@]+@[^\.]+\..+"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

2. Relax NG

The element "A" must contain a string representing an e-mail address.

Valid document


<A Surfns="">nobody@foo.org</A>

Invalid document
This won't be considered as valid e-mail address.


<A Surfns="">xxx</A>

Invalid document
This won't be considered as valid e-mail address.


<A Surfns="">@bar.com</A>

Invalid document
This won't be considered as valid e-mail address.


<A Surfns="">abc@.bar.com</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="myString"/>
    </element>
  </start>

  <define name="myString">
    <data type="string">
      <param name="pattern">[^@]+@[^\.]+\..+</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