W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2003

Casting to types derived from xs:NOTATION

From: Caroline Rioux <crioux@decisionsoft.com>
Date: Tue, 12 Aug 2003 17:35:38 +0100 (BST)
To: "public-qt-comments@w3.org" <public-qt-comments@w3.org>
Message-ID: <Pine.LNX.4.44.0308121732180.19291-100000@ouse.dsl.local>


I have two questions regarding xs:NOTATION.

1. Does there exist a constructor my:notation(xdt:anyAtomicType) for
my:notation derived by restriction from xs:NOTATION?

From F&O 5.2 'Constructor Functions for User-Defined Types':

"For every globally-defined atomic type in the static context (See [XQuery 
1.0: An XML Query Language] that is derived by restriction from a 
primitive type, there is a constructor function [...] whose effect is to 
create a value of that type from the supplied argument"

However F&O 17.15 Casting to xs:NOTATION states:

"It is not possible to cast values of any other type to xs:NOTATION 
because the validity of an xs:NOTATION value is context dependent and 
cannot, in general, be determined."

This appears inconsistent since, according to F&O 5.1, constructors are 
equivalent to casting.

2.  If constructors for types derived from xs:NOTATION exist, how do 
they work?

According to F&O 17.5:

"Casting across the type hierarchy is logically equivalent to three 
separate steps performed in order. Errors can occur in either of the 
latter two steps.

* Cast the source value, up the hierarchy, to the primitive type of the 
* Cast the value to the primitive type of the target type.
* Cast the value down to the target type. "

In the case of xs:NOTATION however: 

xs:string("http://example.com:jpeg") cast as my:notation

(where my:notation is derived by restriction from xs:NOTATION)

should be allowed (see XPath 2.0 Language 3.10.2 4.3), but the second step 
above would fail, since casting from xs:string to xs:NOTATION is not 

Thanks for any clarifications,

Caroline Rioux, Software Engineer           +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services
Received on Tuesday, 12 August 2003 12:25:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC