- From: Ashok Malhotra <ashokma@microsoft.com>
- Date: Tue, 12 Aug 2003 10:38:56 -0700
- To: "Caroline Rioux" <crioux@decisionsoft.com>, <public-qt-comments@w3.org>
Caroline: Which version of the F&O are you looking at? The latest version disallows both constructing xs:NOTATION and casting to it. I think this is the right decision given the context dependent nature of the datatype. All the best, Ashok > -----Original Message----- > From: public-qt-comments-request@w3.org [mailto:public-qt-comments- > request@w3.org] On Behalf Of Caroline Rioux > Sent: Tuesday, August 12, 2003 9:36 AM > To: public-qt-comments@w3.org > Subject: Casting to types derived from xs:NOTATION > > > Hi, > > 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 > source. > * 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 > permitted. > > Thanks for any clarifications, > Caroline > > -- > Caroline Rioux, Software Engineer +44-1865-203192 > DecisionSoft Limited http://www.decisionsoft.com > XML Development and Services > > > >
Received on Tuesday, 12 August 2003 13:39:38 UTC