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

Re: Make an required attribute optional, by restriction?

From: Eric van der Vlist <vdv@dyomedea.com>
Date: 18 Jul 2002 13:22:06 +0200
To: Rainer Becker <r.becker@Nitro-Software.com>
Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Message-Id: <1026991327.23053.34.camel@ibook>

Hi,

On Wed, 2002-07-17 at 11:53, Rainer Becker wrote:

> My first question is: 
> When deriving a type by restriction, I do not think
> that it is a valid restriction for an attribute to an allow an
> use="optional",
> if the same attribute is required in the base type.
> What am I missing here?

Nothing and you're right (that's no valid).

There are two basic derivation methods for complex types: extension and
restriction.

A derivation by restriction restricts the set of instance structures
that can be validated by the type. Your use case is clearly out of this
scope since it's allowing structures without the attribute which were
invalid per the base type.

A derivation by extension lets you add new content (ie new elements
after the content of the base type and new attributes) and your use case
is not in this scope either since you are not adding a new attribute...

If you want to use W3C XML Schema derivation, you will thus need to take
the issue upside/down and to define your derived type as a base type and
vice versa :-)
  
> I must admit that it is very hard for me to read the Structures. It makes
> it even harder, because Im not a native speaker. 

Same for me, but it looks like that's not that much easier to read for
native speakers :-)

Eric
-- 
See you in San Diego.
                               http://conferences.oreillynet.com/os2002/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
Received on Thursday, 18 July 2002 07:22:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC