RE: 25 Feb Structures Questions/Restriction

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 UTC