W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Re: [SQC is right] Derivation by Restriction and Namespaces - SQC Bug?

From: Achille Fokoue <achille@us.ibm.com>
Date: Thu, 3 Jan 2002 10:22:40 -0500 (EST)
To: xmlschema-dev@w3.org, bernauer@dke.uni-linz.ac.at
Cc: jlowery@scenicsoft.com, "Bob Schloss" <rschloss@us.ibm.com>
Message-ID: <OFEA555BA2.95D537E6-ON85256B36.0051B03C@pok.ibm.com>


The latest version of SQC is 1.2.1.003 available at
http://www.alphaworks.ibm.com/tech/xmlsqc.

I think SQC is right.

Martin, your examples test1a.xsd and test1b.xsd  start with <xs:schema
targetNamespace="http://test1a" xmlns:t1a="http://test1a" ...> and
<xs:schema targetNamespace="http://test1b" xmlns:t1a="http://test1a"
xmlns:t1b="http://test1b" ...>. Unfortunately, you did not give us the
values  all the attributes of <xs:schema>.  Among all its possible
attributes, "elementFormDefault" is particularly important to understand
why SQC complains about your schema.

 If  your  two schemas  have  elementFormDefault="unqualified" (it is the
default ), then SQC will not report any error. However, if at least one of
the two schemas specifies elementFormDefault="qualified" then it means that
all local elements in your schema file are qualified and have the same
namespace as the schema target namespace. Since the two schemas do not have
the same target namespace,  the local elements  <xs:element name="entry"
type="t1a:BasicEntry"/>  and <xs:element name="entry" type
="t1b:RestrictedEntry"/>, although they have the same name, are different
because they have different namespaces. Hence,  the content model of
RestrictedList is not a valid  restriction of the content model of
BasicList. That's why SQC reports an error.



I hope this helps,

Achille Fokoue.

IBM T.J. Watson Research Center

xschema@us.ibm.com







Message-ID:
<3549BAFD79A7D411A1CF00508B62B5BC0124B991@exchange-us.scenicsoft.com>
From: Jeff Lowery <jlowery@scenicsoft.com>
To: "'Martin Bernauer'" <bernauer@dke.uni-linz.ac.at>, xmlschema-dev@w3.org
Date: Wed, 2 Jan 2002 16:59:27 -0800
Subject: RE: Derivation by Restriction and Namespaces - SQC Bug?

Shouldn't get any error.

When I run the example through SQC (version 1.2.004), I don't get the error
you're seeing. Are you running a newer or older version?

> -----Original Message-----
> From: Martin Bernauer [mailto:bernauer@dke.uni-linz.ac.at]
> Sent: Wednesday, January 02, 2002 6:27 AM
> To: xmlschema-dev@w3.org
> Subject: Derivation by Restriction and Namespaces - SQC Bug?
>
>
> I have troubles concerning derivation by restriction
> concerning namespaces. When
> I derive a new type by restriction and want to put it in
> another namespace than
> the one of its base type, SQC from alphaworks [1] detects an error.
>
> To illustrate this consider the following example, depicting
> two schemas. Schema
> test1a.xsd defines a "BasicEntry" Type and a "BasicList"
> Type, the contents
> model of the latter type comprises "entry" elements of type
> BasicEntry.
>
> ----------[begin schema test1a.xsd ]----------
> <xs:schema targetNamespace="http://test1a"
> xmlns:t1a="http://test1a" ...>
>   <xs:complexType name="BasicEntry">
>     <xs:sequence>
>       <xs:any/>
>     </xs:sequence>
>   </xs:complexType>
>   <xs:complexType name="BasicList">
>     <xs:sequence>
>       <xs:element name="entry" type="t1a:BasicEntry"/>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> ----------[end schema test1a.xsd ]----------
>
> A second schema, test1b.xsd, derives a new type "RestrictedEntry" from
> BasicEntry by restriction and a new type "RestrictedList"
> from BasicList. Notice
> that the namespace of RestrictedList is http://test1b, while
> the namespace of
> BasicList is http://test1a.
>
> ----------[begin schema test1b.xsd ]----------
> <xs:schema targetNamespace="http://test1b" xmlns:t1a="http://test1a"
> xmlns:t1b="http://test1b" ...>
>   <xs:import namespace="http://test1a" schemaLocation="test1a.xsd"/>
>   <xs:complexType name="RestrictedEntry">
>     <xs:complexContent>
>       <xs:restriction base="t1a:BasicEntry">
>         <xs:sequence>
>           <xs:element name="restrictingElement" type="xs:string"/>
>         </xs:sequence>
>       </xs:restriction>
>     </xs:complexContent>
>   </xs:complexType>
>   <xs:complexType name="RestrictedList">
>     <xs:complexContent>
>       <xs:restriction base="t1a:BasicList">
>         <xs:sequence>
>           <xs:element name="entry" type="t1b:RestrictedEntry"/>
>         </xs:sequence>
>       </xs:restriction>
>     </xs:complexContent>
>   </xs:complexType>
> </xs:schema>
> ----------[end schema test1b.xsd ]----------
>
> When validating test1b.xsd, SQC throws an error reporting
> that the contents
> model of RestrictedList is not a restriction of BasicList.
>
> However, when having all (four) complex type definitions in
> the same namespace,
> SQC accepts the schemas. Since the restrictions themselves
> seem to be valid
> irrespective of the namespaces this seems to be a bug of SQC
> for me. Or is the
> restriction by itself invalid? Any comments on this?
>
> Btw XSV (version 2001/11/29) validates test1b.xsd without
> reporting any
> problems.
>
> Regards, Martin
>
> [1] http://www.alphaworks.ibm.com/tech/xmlsqc
>
> ps: I wasn't able to post this to the SQC discussion forum,
> sorry for any
> inconvienience my posting here may cause, nevertheless it's
> also an XML Schema
> specific question.
>
Received on Sunday, 6 January 2002 15:39:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT