473,372 Members | 828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 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 1033
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jean-Marc Vanel | last post by:
Hello I want to validate against an XML Schema from a DOM Document object without reparsing. If the XML Schema is also from a DOM Document it would be even better. I work with Java. It seems...
6
by: Pieter | last post by:
I've read a lot of posts on "why relax ng is so very good" and on "why w3c xml schema should be the only schema language". I'm, however, still not clear on why I should prefer one over the other. ...
2
by: Rob Exley | last post by:
I think this is a sensible question but am happy to be pointed out the error of my ways. I am specifying a new product for which I would like to have an XML Schema interface (not sure whether...
1
by: Scott Brady Drummonds | last post by:
Hi, everyone, I'm designing my first XML-based application and am stuck on an issue that I presume is pretty simple. I'm trying to write a schema that can be used to validate my XML file. ...
0
by: Steve Jorgensen | last post by:
In a schema I've been working on recently, a convention I evolved was to use a consistent naming pattern such that, for instance, a Resident could appear in a ResidentSet, and could be referred to...
3
by: junlia | last post by:
We are using ACORD xml schema standard, and we need to add to it, so we choose to redefine ACORD xml schema. One of the problems that I ran into is how to add some values to an emumerated list. ...
1
by: serge | last post by:
SQL BPA says the following: "One or more objects are referencing tables/views without specifying a schema! Performance and predictability of the application may be improved by specifying schema...
5
by: Grant Robertson | last post by:
I am only just learning about schema basics. I am trying to understand some fundamental principles about what can be specified within a schema. If I define an enumerated list of values for an...
1
by: JoeZ | last post by:
Hi all, I am using XMLValidatingReader to validate xml instance against schema. Now my question is: in the schema, it has the target name space. In the instance, it doesn't have the name...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.