W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

unconsistent union of patterns

From: michael coburn <miccob087@yahoo.com>
Date: Fri, 3 May 2002 23:58:43 -0400 (EDT)
Message-ID: <20020504035832.77855.qmail@web20505.mail.yahoo.com>
To: xmlschema-dev@w3.org

I am trying to figure out a modelization of email address validation with schemas.

For example I use:

<xsd:simpleType name="EmailAddrType">
  <xsd:union memberTypes="comType  orgType notabcomType"/>
</xsd:simpleType>

  <xsd:simpleType name="EmailType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z]{1,}\@[a-zA-Z]{1,}\.[a-zA-Z]{1,}"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="notabcomType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="^a\@b\.com"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="comType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z]{1,}\@[a-zA-Z]{1,}\.com"/>
    </xsd:restriction>
  </xsd:simpleType>

<xsd:simpleType name="orgType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z]{1,}\@[a-zA-Z]{1,}\.org"/>
    </xsd:restriction>
  </xsd:simpleType>


Questions:

1)  It could be quite time consuming to define all the valid email extensions: org, com, edu, gov, net ....
Is there a way to base a pattern on another one?
For example comType is a subset of EmailType, how could I define this?

2) let's talk about comType and notabcomType (not sure about the writing of notabcomType) but let's assume it carries the interpretation of : a@b.com is not accepted, please correct my syntax,
What is the syntax (if any) of comType union orgType but notabcomType, The one I am struggling with is the "but".

If you write the way I did in the example modulo the syntax issue, the system has no way of finding that the semantic interpretation of notabcomType is inconsistent with the semantic interpretation of comType. Am I right?

3) Do you see a better way to do what I want to do?

Cheers, Mike

 



---------------------------------
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
Received on Saturday, 4 May 2002 06:40:12 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:56 UTC