|
top
|
Subject: RE: two error messages Author: (Deleted User) Date: 25 Feb 2003 04:56 AM
|
At 15.05 24/02/2003 -0500, you wrote:
>From: "Ken Gross"
>
>Alberto,
>
>Thanks for your answer. I think I understand the problem with new namespace.
>
>However, it is not completely clear to me that the namespaces of the two
>redefined objects is "insurance". If you will notice, in Level 2 in the
>first example, the base is still in the "base" namespace even though the
>restrictions could possibly become more stringent. These elements are
>local within the global type which contains them.
>
>So it is not clear to me that the namespace has changed since the elements
>are not global. What am I missing?
The problem is not with the "base" namespace, so let's keep it out of the
picture.
In the Level1Restriction.xsd file, you have:
{w3cSchema:schema targetNamespace="Insurance" ...}
{w3cSchema:complexType name="PolicyClass"}
...
{w3cSchema:restriction base="Base:PolicyClass"}
...
{w3cSchema:element name="CreditSurcharges"}
...
{w3cSchema:element name="PropertySchedule"}
...
This creates a Insurance:PolicyClass, defined as the restriction from
Base:PolicyClass, with two locally defined elements names
Insurance:CreditSurcharges and Insurance:PropertySchedule (being defined in
this schema, they automatically fall into the Insurance namespace).
Then, in Level2Restriction.xsd, you have:
{w3cSchema:schema targetNamespace="Level2" ...}
{w3cSchema:complexType name="MyPolicyClass"}
...
{w3cSchema:restriction base="Insurance:PolicyClass"}
...
{w3cSchema:element name="CreditSurcharges"}
...
{w3cSchema:element name="PropertySchedule"}
...
This defines a new type Level2:MyPolicyClass, that derives by restriction
from Insurance:PolicyClass, and having two brand new elements as children,
Level2:CreditSurcharges and Level2:PropertySchedule.
So you are creating new types that by chance are exact copies of the
already existing Insurance:CreditSurcharges and Insurance:PropertySchedule,
and this is not allowed by the rules on restriction. What you could do is
to restrict their cardinality, by using
{w3cSchema:element ref="Insurance:CreditSurcharges" minOccurs=".."
maxOccurs=".."/}
{w3cSchema:element ref="Insurance:PropertySchedule" minOccurs=".."
maxOccurs=".."/}
("ref" reuses existing definitions, "name" create new ones in the
targetNamespace of the current file).
Alberto
|
|
|
|