RE: [pointless:Partiles:Structure]: i cannot understand this phrase...

> -----Original Message-----
> From:	C. M. Sperberg-McQueen [SMTP:cmsmcq@acm.org]
> Sent:	Monday, July 23, 2001 5:46 PM
> To:	Martin Gudgin
> Cc:	choi jongwon; Henry S. Thompson; www-xml-schema-comments@w3.org
> Subject:	Re: [pointless:Partiles:Structure]: i cannot understand this
> phrase...
> 
> Writing
> 
>    <xsd:element name="dink">
>     <xsd:complexType>
>      <xsd:sequence/>
>     </xsd:complexType>
>    </xsd:element>
> 
> makes sure that 'dink' elements have no children (warning:
> culture-specific humor may be present here; as a demographic label for
> childless couples both of whom have a job, 'dink' is short for "double
> income, no kids", so it's a constitutive feature of dinks that they
> have no children).
> 
Thanx Michael, that explanation was very helpful.  Reading your explanation
has gotten me over a hurdle in a schema that I am writing, but I wonder if
this is the best solution...

Suppose I have the following:

	<xsd:element name='e' type='base''/>
	<xsd:complexType name='base' mixed='true'>
		<xsd:annotation>
			<xsd:documentation>
				<![CDATA[
					<!ELEMENT e (#PCDATA | e1 | e2')*>
				]]>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:choice minOccurs='0' maxOccurs='unbounded'>
			<xsd:element name='e1' type='stirng'/>
			<xsd:element name='e2' type='string'/>
		</xsd:choice>
	</xsd:complexType>

Suppose further that I want to restrict type base so that only character
data is allowed.  I would like to do the following:

	<xsd:element name='e' type='restriction'/>
	<xsd:complexType name='restriction' mixed='true'>
		<xsd:annotation>
			<xsd:documentation>
				<![CDATA[
					<!ELEMENT e (#PCDATA)*>
				]]>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexContent>
			<xsd:restriction base='base'>
				<xsd:choice minOccurs='0' maxOccurs='0'>
					<xsd:element name='e1'
type='stirng'/>
					<xsd:element name='e2'
type='string'/>
				</xsd:choice>
			</xsd:restriction>
		</xsd:complexContent>
	</xsd:complexType>

However, at least one schema processor that I've tried (xsv) doesn't like
the above restriction (xerces 1.4.2 has no problem with it) and dies a
horrible death (which leads me to believe that this may not be possible).

The following, however, does work in both xsv and xerces:

	<xsd:element name='e' type='restriction'/>
	<xsd:complexType name='restriction' mixed='true'>
		<xsd:annotation>
			<xsd:documentation>
				<![CDATA[
					<!ELEMENT e (#PCDATA)*>
				]]>
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexContent>
			<xsd:restriction base='base'>
				<xsd:sequence/>
			</xsd:restriction>
		</xsd:complexContent>
	</xsd:complexType>

and gives me the desired affect, although the intent is not nearly as
transparent to the casual reader.

I have 2 questions. 1) should the 1st attempt I tried have worked?---i.e.,
restricting choice from 0-unbounded to 0-0; 2) will replacing a choice with
an empty sequence always result in an "non-occuring" particle at that point
in the content model?

pvb

Received on Wednesday, 25 July 2001 17:13:19 UTC