[Bug 4273] [FS] data on element()

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4273





------- Comment #13 from tim@cbcl.co.uk  2007-10-22 13:12 -------
Mike, if I understand you correctly, when you say:

"an element annotated as xs:anyType"

and 

"a value V is that satisfies element(*,xs:anyType)"

you are getting at the difference between the type actually assigned by schema
verification and whether the type assigned matches element(*, xs:anyType).

Lets assume that after schema validation, an element E is typed to be
xs:anyType.  i.e. it's type is element(E, xs:anyType).  In XQuery 2.5.2 Typed
Value and String Value, I find the following strange:

"If the type annotation is xs:anySimpleType or ... (including xs:anyType), then
the typed value of the node is equal to its string value, as an instance of
xs:untypedAtomic. "

which I take to mean:

(1) data on element(*, xs:anySimpleType) = xs:untypedAtomic
(2) data on element(*, xs:anyType) = xs:untypedAtomic

Each of these violates the rule for substitution to work, namely:

T <: U
----------------------------------------------
data on element(*, T) <: data on element(*, U)

But the following does not hold if (1) and (2) hold

element(*, xs:integer) <: element(*, xs:anySimpleType)
----------------------------------------------------------------------
data on element(*, xs:integer) <: data on element(*, xs:anySimpleType)

and neither does:

element(*, xs:integer) <: element(, xs:anyType)
---------------------------------------------------------------
data on element(*, xs:integer) <: data on element(, xs:anyType)

because xs:integer is not a subtype of xs:untypedAtomic.  Make xs:untypedAtomic
a subtype of all the other atomic types and I'd guess that this would all work
out; but this isn't how untypedAtomic has been defined.

I believe (1) and (2) to be wrong because the type of the data isn't known to
be untypedAtomic, it's just that we don't know what the type is.  From XML
Schema,

"The content of the element declared in this way is unconstrained, so the
element value may be 423.46, but it may be any other sequence of characters as
well, or indeed a mixture of characters and elements. "

which I'd hope means:

the element value may be the decimal 423.46

as opposed to 

the element value may be the untypedAtomic 423.46

Received on Monday, 22 October 2007 13:12:56 UTC