Re: Namespace considerations

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

Received on Wednesday, 19 February 2003 09:43:24 UTC