W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Re: EMPTY elements -- PLEASE HELP

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Tue, 09 Oct 2001 11:55:14 +0200
Message-ID: <3BC2C982.8000405@dyomedea.com>
To: maddy pawar <madhuvanti@hotmail.com>
Cc: xmlschema-dev@w3.org
maddy pawar wrote:

> Hi all,
> 
> How do i specify --
> 
> 1) that an element is ALWAYS Empty


By "forgeting" to add any content, for instance:

<xs:element name="foo">
	<xs:complexType>
			<xs:attribute name="bar" type="xs:string"/>
	</xs:complexType>
</xs:element>


> 
> 2) that an element cannot be Empty


By giving a content model that cannot be empty.

This content model can be complex:

<xs:element name="foo">
	<xs:complexType>
			<xs:sequence>
					<xs:element ref="bar"/>
			</xs:sequence>
	</xs:complexType>
</xs:element>

(here the minimum number of occurences of "bar" is (by default) 1 so 
"foo" cannot be empty).

or simple:

<xs:element name="foo">
	<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:minLength value="1"/>
			</xs:restriction>
	</xs:simpleType>
</xs:element>

(here, the minimum length of the string contained in "foo" is 1 so "foo" 
cannot be empty).

Hope this helps.

Eric


>  
> 
> regds,Maddy
> 
>  
> 



-- 
Rendez-vous  Paris pour une visite guidee de la nebuleuse XML.
                                           http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Tuesday, 9 October 2001 05:54:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:24 GMT