| Author |
xschoice vs xs:enumeration
|
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
|
<xs:choice> and xs:enumeration looks same. How xs:enumeartion fdiffer from xs:cohice ?
|
 |
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
Hi Bartender, Please move this thread to
XML and related Technologies
|
 |
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
|
|
Hi!
The <choice> element allows one of the elements contained in the <choice> element to be present in the containing element. Note that if you set maxOccurs to, for instance, 2 then you are allowed to choose two of elements inside the <choice> element.
Enumeration is a facet that you can use when defining a simple type. The enumeration facet allows you to provide a list of allowed values for the type in question.
If you want examples, please let me know!
Best wishes!
|
 |
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
|
Hi Ivan, can you give examples for allowing two elements inside the <choice> element ?
|
 |
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
|
|
Hi!
The following XML schema allows one person to own at most two computers and requires the person to own at least one computer:
The following XML fragment is valid according to the above schema:
We can see that Ivan owns a MacBook, which is a notebook, and a Zuug 2000, which is a desktop computer - all in all two computers.
Best wishes!
|
 |
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
|
Hi Ivan, If i do not give minOccurs and maxOccurs in this line How choice will behave ?
|
 |
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
|
|
Hi!
I answer your question with a question:
What are the default values for minOccurs and maxOccurs?
Best wishes!
|
 |
 |
|
|
subject: xschoice vs xs:enumeration
|
|
|