Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Problem about imported schema type when processing XQuery module import

From: "he harrison" <harrison076@-----.--->
To: xml-dev@-----.---.---
Date: 1/2/2008 3:12:00 AM
Hi, I come up with a problem when reading XQuery spec., following is my case:

a.xq:

module namespace ma="http://www.w3.org/TestModules/moduleA";

import schema namespace simple="http://www.w3.org/XQueryTest/simple" at "schema_a.xsd";
declare function ma:funcA()
{
   "40" cast as simple:myType

};

b.xq:

module namespace mb="http://www.w3.org/TestModules/moduleB";
import module namespace ma="
http://www.w3.org/TestModules/moduleA" at "a.xq";
declare function mb:funcB()
{
   ma:funcA() treat as xs:integer
};

c.xq:

declare namespace mc="
http://www.w3.org/TestModules/moduleC";
import module namespace mb="http://www.w3.org/TestModules/moduleB" at "b.xq";
import schema namespace simple="
http://www.w3.org/XQueryTest/simple" at "schema_c.xsd";

declare function mc:funcC()
{
  mb:funcB() instance of simple:myType
};

<result>{mc:funcC()}</result>


schema_a.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:simple="
http://www.w3.org/XQueryTest/simple" 
           targetNamespace="http://www.w3.org/XQueryTest/simple" 
           elementFormDefault="qualified" attributeFormDefault="qualified"

>
  <xs:simpleType name = "myType">
     <xs:restriction base = "xs:int">
      <xs:minInclusive value = "1"/>
      <xs:maxInclusive value = "50"/>

    </xs:restriction>
   </xs:simpleType>    
</xs:schema>

schema_c.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema
" 
           xmlns:simple="http://www.w3.org/XQueryTest/simple" 
           targetNamespace="http://www.w3.org/XQueryTest/simple
" 
           elementFormDefault="qualified" attributeFormDefault="qualified"
>
  <xs:simpleType name = "myType">
     <xs:restriction base = "xs:int">

      <xs:minInclusive value = "51"/>
      <xs:maxInclusive value = "100"/>
    </xs:restriction>
   </xs:simpleType>    
</xs:schema>

Main module is 
c.xq, what should be output?
The key problem is, whether we need to keep different type definition in each module,
in case imported types have same name and actually are different?
I tried some XQuery processors, they all give different result and most of them are obviously wrong...


Another further problem is, if we choose to ignore types imported from other modules, while we need to recognize types bring by XML documents,
then it seems confusion when we handle a returned value of a function, as we need to distinguish where the value comes from:

defined by module or get from document.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent