[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem about imported schema type when processing XQuery module import

  • From: "he harrison" <harrison076@g...>
  • To: xml-dev@l...
  • Date: Wed, 2 Jan 2008 11:12:16 +0800

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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.