471,356 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

schema, specifying alternatives

This is probably an easy question for someone, but not me:

In a W3C schema I should like to specify that an element can contain
EITHER multiple instances of one entity OR just one instance of another.

e.g. element <bed> will be allowed to have up to seven instances of
element <dwarf> OR one instance of element <snow_white>, but the
occurrence of both <snow_white> and even one <dwarf> in the same <bed>
is not allowed.

does it help/hinder if the character of the element is specified as an
attribute instead of the element name? e.g. <character type="dwarf">,
<character type="snow_white>
Aug 13 '05 #1
2 1000
On Sat, 13 Aug 2005 11:15:31 +0200, shaun roe <sh*******@wanadoo.fr> wrote:
This is probably an easy question for someone, but not me:

In a W3C schema I should like to specify that an element can contain
EITHER multiple instances of one entity OR just one instance of another.

e.g. element <bed> will be allowed to have up to seven instances of
element <dwarf> OR one instance of element <snow_white>, but the
occurrence of both <snow_white> and even one <dwarf> in the same <bed>
is not allowed.

does it help/hinder if the character of the element is specified as an
attribute instead of the element name? e.g. <character type="dwarf">,
<character type="snow_white>


<xs:element name="bed">
<xs:complexType>
<xs:choice>
<xs:element ref="snow_white">
<xs:element ref="dwarf" maxOccurs="7">
</xs:choice>
</xs:complexType>
<xs:element>
Aug 13 '05 #2
On Sat, 13 Aug 2005 02:45:24 -0700, Steve Jorgensen <no****@nospam.nospam>
wrote:
On Sat, 13 Aug 2005 11:15:31 +0200, shaun roe <sh*******@wanadoo.fr> wrote:
This is probably an easy question for someone, but not me:

In a W3C schema I should like to specify that an element can contain
EITHER multiple instances of one entity OR just one instance of another.

e.g. element <bed> will be allowed to have up to seven instances of
element <dwarf> OR one instance of element <snow_white>, but the
occurrence of both <snow_white> and even one <dwarf> in the same <bed>
is not allowed.

does it help/hinder if the character of the element is specified as an
attribute instead of the element name? e.g. <character type="dwarf">,
<character type="snow_white>


<xs:element name="bed">
<xs:complexType>
<xs:choice>
<xs:element ref="snow_white">
<xs:element ref="dwarf" maxOccurs="7">
</xs:choice>
</xs:complexType>
<xs:element>


Oops - forgot to close all the tags...

<xs:element name="bed">
<xs:complexType>
<xs:choice>
<xs:element ref="snow_white"/>
<xs:element ref="dwarf" maxOccurs="7"/>
</xs:choice>
</xs:complexType>
</xs:element>

Aug 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jean-Marc Vanel | last post: by
2 posts views Thread by Rob Exley | last post: by
1 post views Thread by Scott Brady Drummonds | last post: by
3 posts views Thread by junlia | last post: by
5 posts views Thread by Grant Robertson | last post: by
1 post views Thread by JoeZ | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.