W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2012

Re: What is the type of an element with a fixed value?

From: Michael Kay <mike@saxonica.com>
Date: Tue, 28 Aug 2012 00:07:41 +0100
Message-ID: <503BFDBD.30507@saxonica.com>
To: xmlschema-dev@w3.org
The presence of a fixed value does not affect the type, which is 
determined in the usual way based on the type attribute or equivalent. 
In your examples there is no type attribute so the type is xs:anyType. 
The fixed value must of course be valid against the type, though if it 
isn't, this is considered a validation failure in the instance rather 
than a problem with the schema.

(IIRC, the use of a fixed value with a mixed content type such as 
xs:anyType is poorly defined in XSD 1.0 but is clarified in XSD 1.1)

Michael Kay
Saxonica

On 27/08/2012 22:35, Costello, Roger L. wrote:
> Hi Folks,
>
> What is the type of Foo?
>
>      <element name="Foo" fixed="Hello World" />
>
> Is it:
>
> (a) xs:string
>
> (b) xs:anyType
>
>
> What is the type of Bar?
>
>      <element name="Bar" fixed="93" />
>
> Is it:
>
> (a) xs:string
>
> (b) xs:decimal
>
> (c) xs:anyType
>
>
> /Roger
>
>
Received on Monday, 27 August 2012 23:07:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 August 2012 23:07:45 GMT