RE: Namespace considerations

Thank you very much for your reply, it clears up a lot.  

Just to be clear though (before I implement this ;-)), Jonathan 
mentions below that the datatypes in the 
"http://www.w3.org/2001/XMLSchema-datatypes" namespace are only available 
if that schema is imported.  

In the XPath 2.0 spec, section 2.6.2.1.1 (Basic XPath) it states that:

"In a Basic XPath implementation, the in-scope schema definitions consist 
of a fixed set of 48 predefined type definitions. These include the 44 
built-in datatypes defined in [XML Schema], plus four additional types: 
fn:yearMonthDuration,  fn:dayTimeDuration, xs:anySimpleType, and 
xs:anyType."

Wouldn't that mean that in a basic XPath2 implementation, without importing 
the above schema, only the third example below is legal?  

<snip>

> > for example, if I bind xf to "http://www.w3.org/2001/XMLSchema" and
> > xs to "http://www.w3.org/2001/XMLSchema-datatypes", then which of these
> > (or all?) are legal? 
> >
> > 'cast as xs:string(xs:decimal("15.5"))'
> > 'cast as xf:string(xs:decimal("15.5"))'
> > 'cast as xf:string(xf:decimal("15.5"))'

Also, 

> > On a different note, I thought that xs was bound to
> > "http://www.w3.org/2001/XMLSchema" in the spec simply for convenience.
> > You seem to imply that it is a predefined prefix which is always bound to
> > "http://www.w3.org/2001/XMLSchema".
> 
> This is correct.

[I assume you mean that Jonathan's implication was correct?] So does this 
mean that this xs: binding takes precedence over any other xs: binding 
done by a user in a document?

Thanks very much for your help,
Caroline


On Tue, 4 Mar 2003, Michael Rys wrote:

> My apologies that nobody seem to have answered. 
> 
> See below for my reply.
> 
> Best regards
> Michael
> 
> > -----Original Message-----
> > From: Caroline Rioux [mailto:crioux@decisionsoft.com]
> > Sent: Tuesday, March 04, 2003 7:19 AM
> > To: public-qt-comments@w3.org
> > Subject: Re: Namespace considerations
> > 
> > 
> > Hi,
> > 
> > I posted the following a few weeks ago.. if anyone could a look at
> this,
> > that would be great,
> > 
> > Caroline
> > 
> > --
> > Caroline Rioux, Software Engineer           +44-1865-203192
> > DecisionSoft Limited
> http://www.decisionsoft.com
> > XML Development and Services
> > 
> > ---------- Forwarded message ----------
> > Date: Wed, 19 Feb 2003 16:29:09 +0000 (GMT)
> > From: Caroline Rioux <crioux@decisionsoft.com>
> > To: Jonathan Robie <jonathan.robie@datadirect-technologies.com>
> > Cc: public-qt-comments@w3.org
> > Subject: Re: Namespace considerations
> > 
> > Thanks for the quick reply,
> > 
> > What I am unsure about though, is whether or not users of an XPath2
> > implementation can invoke constructors within either namespace?
> > 
> > for example, if I bind xf to "http://www.w3.org/2001/XMLSchema" and
> > xs to "http://www.w3.org/2001/XMLSchema-datatypes", then which of
> these
> > (or all?) are legal?
> > 
> > 'cast as xs:string(xs:decimal("15.5"))'
> > 'cast as xf:string(xs:decimal("15.5"))'
> > 'cast as xf:string(xf:decimal("15.5"))'
> >
> [Michael Rys] All are legal since they construct strings :-). And even
> if you remove the 's the above expressions should be legal.
> 
> However note that as Jonathan points out below, xs:decimal is not really
> the same type as xf:decimal, instead xs:decimal is considered a subtype
> of xf:decimal.
> 
> > On a different note, I thought that xs was bound to
> > "http://www.w3.org/2001/XMLSchema" in the spec simply for convenience.
> > You seem to imply that it is a predefined prefix which is always bound
> to
> > "http://www.w3.org/2001/XMLSchema".
> 
> This is correct.
> 
> >  Yet the F&O specs do use the
> > xs: prefix for constructors, which is defined to be in the
> > "http://www.w3.org/2001/XMLSchema-datatypes" namespace.
> 
> [Michael Rys] This is a bug and should be fixed in the next version.
> Ashok, please take note.
>  
> > Thanks again for your help,
> > Caroline
> 
> [Michael Rys] Thanks for your comment.
> 
> > 
> > On Wed, 19 Feb 2003, Jonathan Robie wrote:
> > 
> > >
> > > Hi Caroline,
> > >
> > > Good question! The short answer is that you can use
> > > ""http://www.w3.org/2001/XMLSchema-datatypes" only if you import
> that
> > > schema. Even though the same set of datatypes are available under
> either
> > > namespace, the datatypes in the two namespaces are not exactly
> > identical.
> > > If you go to the above URI, you can download the schema for
> datatypes,
> > and
> > > you will see that it looks like the following excerpt:
> > >
> > > <schema xmlns="http://www.w3.org/2001/XMLSchema"
> > >                targetNamespace="http://www.w3.org/2001/XMLSchema-
> > datatypes"
> > >              version="$Id: XMLSchema-datatypes.xsd,v 1.5 2001/03/16
> > > 20:53:32 ht Exp $">
> > >
> > >    <simpleType name="string">
> > >     <restriction base="string"/>
> > >    </simpleType>
> > >
> > >    <simpleType name="boolean">
> > >     <restriction base="boolean"/>
> > >    </simpleType>
> > >    <!-- SNIP -->
> > >
> > > For each datatype in the "http://www.w3.org/2001/XMLSchema"
> namespace,
> > it
> > > defines a new datatype in the "http://www.w3.org/2001/XMLSchema-
> > datatypes"
> > > namespace, deriving it from the original by trivial restriction.
> > >
> > > You can import this schema like any other schema. It's often easier
> to
> > > simply use the predefined xs: prefix, which always points to
> > > "http://www.w3.org/2001/XMLSchema".
> > >
> > > Jonathan
> > >
> > > At 06:13 PM 2/18/2003 +0000, Caroline Rioux wrote:
> > >
> > > >Hi,
> > > >
> > > >I need some clarification on the namespaces used for constructors
> and
> > > >datatypes.
> > > >
> > > >In the F&O spec, section 1.5 it says:
> > > >
> > > >The URIs of the namespaces are:
> > > >   * http://www.w3.org/2001/XMLSchema-datatypes for constructors
> > > >   * http://www.w3.org/2002/11/xquery-operators for operators
> > > >   * http://www.w3.org/2002/11/xquery-functions for functions.
> > > >
> > > >Which implies that constructors are in the
> > > >http://www.w3.org/2001/XMLSchema-datatypes namespace
> > > >
> > > >In XML Schema Part 2: Datatypes section 3.1 (Namespace
> Considerations)
> > > >
> > > >   The *built-in* datatypes defined by this specification are
> designed
> > to be
> > > >   used with the XML Schema definition language as well as other
> XML
> > > >   specifications. To facilitate usage within the XML Schema
> definition
> > > >   language, the *built-in* datatypes in this specification have
> the
> > > >   namespace name:
> > > >
> > > >   http://www.w3.org/2001/XMLSchema
> > > >
> > > >   To facilitate usage in specifications other than the XML Schema
> > definition
> > > >   language, such as those that do not want to know anything about
> > aspects of
> > > >   the XML Schema definition language other than the datatypes,
> each
> > > >   *built-in* datatype is also defined in the namespace whose URI
> is:
> > > >
> > > >   http://www.w3.org/2001/XMLSchema-datatypes
> > > >
> > > >
> > > >Does this mean that either namespace can be used, even in the case
> of
> > > >construction?
> > > >
> > > >Thanks for any clarification,
> > > >
> > > >--
> > > >Caroline Rioux, Software Engineer           +44-1865-203192
> > > >DecisionSoft Limited
> http://www.decisionsoft.com
> > > >XML Development and Services
> > >
> > >
> > 
> > --
> > Caroline Rioux, Software Engineer           +44-1865-203192
> > DecisionSoft Limited
> http://www.decisionsoft.com
> > XML Development and Services
> > 
> 
> 

-- 
Caroline Rioux, Software Engineer           +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services

Received on Wednesday, 5 March 2003 05:16:03 UTC