[xquery-talk] How to understand err:XQST0035?

Michael Kay mike at saxonica.com
Wed Jan 2 09:27:48 PST 2008


The consistency constraints in section 2.2.5 say that this is not allowed:
 
"For a given query, define a participating ISSD as the
<blocked::http://www.w3.org/TR/xquery/#dt-issd> in-scope schema definitions
of a module that is used in evaluating the query. If two participating ISSDs
contain a definition for the same schema type, element name, or attribute
name, the definitions must be equivalent in both ISSDs."
 
The introductory paragraph of 2.2.5 says "This specification does not define
the result of a query under any condition in which one or more of these
constraints is not satisfied." - in other words, it's an error to have two
different types with the same name, but it's not an error that an
implementation is required to detect and report. You can report XQST0035 if
you want, or you can simply crash and burn, or you can run the query and
report any results you like - it's your decision as an implementor how much
checking you want to do.
 
Section 2.2.5 also imposes constraints that require the types derived from
validating input documents to be consistent with those that are imported
into the static context.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Jiang, Weihua
Sent: 02 January 2008 02:28
To: talk at x-query.com
Subject: [xquery-talk] How to understand err:XQST0035?



Hi all,

 

We are now trying to implement an XQuery processor. However, now, we have a
problem about the type system. 

 

The case is: 

1.       Module A import schema file schemaA.

2.       Module B import schema file schemaB.

3.       schemaA and schemaB define a same-name (same namespace and same
local name) schema type.

4.       Module A import module B. 

Will this schema type name conflict cause err:XQST0035 or not? Though, in
module A, it doesn't import schemaB, err:XQST0035 is so strong that it says:

It is a static error <http://www.w3.org/TR/xquery/#dt-static-error>
[err:XQST0035 <http://www.w3.org/TR/xquery/#ERRXQST0035> ] if multiple
imported schemas, or multiple physical resources within one schema, contain
definitions for the same name in the same symbol space (for example, two
definitions for the same element name, even if the definitions are
consistent). However, it is not an error to import the schema with target
namespace http://www.w3.org/2001/XMLSchema (predeclared prefix xs), even
though the built-in types defined in this schema are implicitly included in
the in-scope schema  <http://www.w3.org/TR/xquery/#dt-is-types> types.

 

It doesn't say the multiple imported schemas shall be in the same prolog.
So, it seems the above case shall report err:XQST0035. If so, then no type
name conflict can appear at global level (i.e. all the imported types,
except built-in types, in all modules shall be unique). 

 

Or more precise question is: does err:XQST0035 ensure the type systems used
in dynamic evaluation phase has no name conflict? 

 

Thanks

Weihua

 

The case code is:

//schemaA.xsd

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.hats.com/hats">

 

<xs:simpleType name="HatSize">

     <xs:restriction base="xs:integer">

               <xs:minInclusive value="1"/>

               <xs:maxInclusive value="10"/>

     </xs:restriction>

</xs:simpleType>

 

</xs:schema>

 

//schemaB.xsd

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.hats.com/hats">

 

<xs:simpleType name="HatSize">

     <xs:restriction base="xs:integer">

               <xs:minInclusive value="1"/>

               <xs:maxInclusive value="20"/>

     </xs:restriction>

</xs:simpleType>

 

</xs:schema>

 

 

      //B.xq

      module namespace module1="http://www.hats.com/module1";

import schema namespace hats="http://www.hats.com/hats" at "schemaB.xsd";

 

declare function module1:function1() as xs:integer

{

         ("4" cast as hats:HatSize) treat as xs:integer

};

 

 

//A.xq

import module namespace module1="http://www.hats.com/module1" at "B.xq";

 

import schema namespace hats="http://www.hats.com/hats" at "schemaA.xsd";

 

module1:function1() instance of hats:HatSize

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20080102/cd98c158/attachment-0001.htm


More information about the talk mailing list