- From: Martin Bernauer <bernauer@dke.uni-linz.ac.at>
- Date: Wed, 2 Jan 2002 15:26:36 +0100
- To: <xmlschema-dev@w3.org>
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 Wednesday, 2 January 2002 09:48:55 UTC