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

Jiang, Weihua weihua.jiang at intel.com
Wed Jan 2 10:27:43 PST 2008


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 types.
<http://www.w3.org/TR/xquery/#dt-is-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/60b497bc/attachment.htm


More information about the talk mailing list