W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

RE: 25 Feb Structures Questions/Restriction

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Fri, 10 Mar 2000 10:08:01 -0700
Message-ID: <00E567D938B9D311ACEC00A0C9B468730C7647@THOR>
To: "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>
Cc: "'xml-dev@xml.org'" <xml-dev@xml.org>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Henry Thompson wrote:

>The new design for complex type definition by restriction is that you
>supply a complete type definition which you _assert_ is a restriction, 
>and this is checked at schema processing time.  No copying from the
>base type definition is performed.  This is different from simple type 
>definition by restriction, were unmentioned facets _are_ copied down, as 
>it were.

My initial impression was that that would be more complex than the
XPath-ish proposal.  What took a few seconds to dawn on me was 
the restriction type definition may not need to be as complex 
as the base type definition.  It only has to be specific enough 
so that the undesired content is not legal for the restriction type.

Something like:

<type name="type1" source="reallyComplexBaseType">
	<element ref="element1" minOccur="0"/>
	<element ref="element2" minOccur="0"/>
	<element ref="element3" minOccur="0"/>
</type>

To make element2 required:

<type name="type2" base="type1">
	<restrict>
		<type>
			<any exclude="element2" minOccur="0" maxOccur="*"/>
			<element ref="element2" minOccur="1"/>
			<any/>
		</type>
	</restrict>
</type>

To make element2 prohibited:			

<type name="type2" base="type1">
	<restrict>
		<type>
			<any exclude="element2" minOccur="0" maxOccur="*"/>
		</type>
	</restrict>
</type>


I think that you would need to give any and anyAttribute
and exclude attribute that is a list of qnames and you are home.
The parser is required to validate that the content is valid
both for the base type and the restriction type.
Received on Friday, 10 March 2000 12:13:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT