XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Problem about imported schema type when processing XQuery module import

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.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS