Re: EMPTY elements -- PLEASE HELP

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 UTC