[xquery-talk] RE: What identifies an XML schema in XQuery, target namespace or schema location?

Chen, Haifeng haifeng.chen at intel.com
Mon Jan 14 09:51:02 PST 2008


Thanks Michael!

Since ¡°same schema different schema file¡± case is not defined in XQuery, to some extent the implementer has some choice of how far the investigation goes on. But for a general user who using a general XQuery processor, the result of below XQuery expression should be at least reasonable and understandable at the schema¡¯s perspective. 

 

So my question is,

Which is more reasonable for a general XQuery processor to identify the schema, target namespace or schema location?

 

The answer to this question will decide a more reasonable result that a user can accept for the XQuery expression below, true or error.

 

Thanks again,

Haifeng Chen

 

________________________________

From: Michael Rys [mailto:mrys at microsoft.com] 
Sent: 2008Äê1ÔÂ10ÈÕ 13:50
To: Chen, Haifeng; talk at x-query.com
Subject: RE: What identifies an XML schema in XQuery, target namespace or schema location?

 

The XQuery spec makes it clear that it is the namespace URI of the schema and the local name of the component that uniquely identifies a schema component. Since equivalence of schema components from different schema files is not defined in XQuery, the result is system-dependent on how far the type equivalence investigation goes during the compilation/linking of the two modules.

 

Best regards

Michael

 

From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf Of Chen, Haifeng
Sent: Wednesday, January 09, 2008 6:34 PM
To: talk at x-query.com
Subject: [xquery-talk] What identifies an XML schema in XQuery, target namespace or schema location?

 

Dear XQuery experts,

I come to a question related to the schema import in XQuery. The following is the context,

 

Given two XSD files named hats1.xsd and hats2.xsd (note: contents of these two files are the same) stored at the current directory as following,

1.    hats1.xsd (A schema defines a simple type HatSize)

 

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

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

xmlns="http://www.hats.com/hats"

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>

 

2.    hats2.xsd (A schema defines a simple type HatSize)

 

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

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

xmlns="http://www.hats.com/hats"

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>

 

Given two XQuery files named module1.xq and module2.xq stored at the current directory as following,

 

3.    module1.xq (A module contains a function simply return a HatSize instance, importing schema hats1.xsd)

 

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

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

 

declare function module1:function1() as hats:HatSize

{

5 cast as hats:HatSize

};

 

4.    module2.xq (Main module call the function and test instance of HatSize over the instance, importing schema hats2.xsd)

 

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

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

 

module1:function1() instance of hats:HatSize

 

Question: 

 

What¡¯s the right result when evaluating on module2.xq? 

A.    true

B.    false

C.    static error should be raised

D.    dynamic error should be raised

 

It is actually asking ¡°what identifies an XML schema, target namespace or schema location?¡±

 

Thanks,

Haifeng Chen

 

 

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


More information about the talk mailing list