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

Re: Restriction of Data Type

From: Eddie Robertsson <eddie@allette.com.au>
Date: Mon, 04 Feb 2002 10:20:09 +1100
Message-ID: <3C5DC5A9.B8271CD2@allette.com.au>
To: Autumn Cuellar <a.cuellar@auckland.ac.nz>
CC: xmlschema-dev@w3.org

>     <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?

Not really. When you choose to use the ref attribute you can never redefine
the type of the element or attribute. The ref attribute means that it is a
reference to the original attribute/element and you can't change that.
To redefine a type of an attribute you have to use the xs:redefine function

> 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...)

No. AFAIK there's no way of specifyijng exclusions like this in W3C XML


[1] http://www.w3.org/TR/xmlschema-0/#Redefine

> Thanks!
> --
> Autumn A. Cuellar
> Bioengineering Institute
> The University of Auckland
> New Zealand
Received on Sunday, 3 February 2002 18:11:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:58 UTC