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

Restriction of Data Type

From: Autumn Cuellar <a.cuellar@auckland.ac.nz>
Date: Thu, 31 Jan 2002 20:07:21 -0500 (EST)
Message-ID: <3C59EA30.7F2EEBA6@auckland.ac.nz>
To: xmlschema-dev@w3.org
Here's a snippet from an XML Schema I'm coding up:

    <xsd:attribute ref="cellml:name" use="required" />
      <xsd:simpleType>
        <xsd:restriction base="cellml:CellMLidentifier">
          <xsd:pattern value="^(ampere)^(becquerel)" />
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>

In explanation (should you need one), the cellml:name attribute is a
global att. with type="cellml:CellMLidentifier" (which restricts the
string datatype to just letters, digits, and underscores).  In this
instance I want to further restrict the value so that it cannot be
certain words, e.g. the value of the name attribute cannot be "ampere"
nor "becquerel".  Two questions:
1)Is this a valid way to further restrict the type of the global
attribute?
2)Is using the <pattern> element the way I've used it valid, and does it
convey what I intended?  (ok, maybe that was 3 questions...)

Thanks!
 
-- 
Autumn A. Cuellar
Bioengineering Institute
The University of Auckland
New Zealand
Received on Friday, 1 February 2002 11:19:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT