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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Costello, Roger L.
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

Reply | Threaded
Open this post in threaded view
|

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

Michael Kay
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
>
>


Reply | Threaded
Open this post in threaded view
|

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

C. M. Sperberg-McQueen-2
In reply to this post by Costello, Roger L.

On Aug 27, 2012, at 3:35 PM, 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

Is there a particular part of the spec you are having trouble
interpreting?

--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************