Re: Fw: Q: Fixed value constraint validation for elements

Sandy Gao <sandygao@ca.ibm.com> writes:

> Hi,
>
> In the schema spec [1] , we have the following rule:
>
>         5.2.2.2.2 If the {content type} of the ·actual type
> definition· is a simple type definition, then the ·actual value· of
> the item must match the canonical lexical representation of the
> {value constraint} value.
>
> If I have a schema where element 'e1' is declared as anySimpleType with a 
> fixed value of '123', and in my instance document, I have element 'e'1 
> present with an xsi:type of 'int' and a content of '123'. Would the 
> content of element 'e1' be considered valid or invalid?

Implementation-dependent.  Most implementations will take advantage of
the flexibility provided by the clarification wrt anySimpleType added
to version 1.1 [2]

  "The mapping from lexical space to value space is unspecified for
  items whose type definition is the *simple ur-type
  definition*. Accordingly this specification does not constrain
  processors' behaviour in areas where this mapping is implicated, for
  example checking such items against enumerations, constructing
  default attributes or elements whose declared type definition is the
  *simple ur-type definition*, checking identity constraints involving
  such items." 

in the most obvious way, and use a member of the value space of
xs:string for values of xs:anySimpleType, in which case your example
will be valid.  But an implementation _could_ decide to map all
obviously numeric strings to xs:decimal values, in which case you
example would be _invalid_, because the canonical lexical form of the
relevant value is "123.0".

Sorry about that.

ht

> [1] http://www.w3.org/TR/xmlschema-1/#d0e4333
[2] http://www.w3.org/TR/xmlschema-1/#Simple_Type_Definition
-- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Friday, 25 March 2005 11:04:19 UTC