Re: Restriction of Data Type

Hi,

>     <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
[1].


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

Cheers,
/Eddie

[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