aspose file tools*
The moose likes Web Services and the fly likes xschoice    vs  xs:enumeration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "xschoice    vs  xs:enumeration" Watch "xschoice    vs  xs:enumeration" New topic
Author

xschoice vs xs:enumeration

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1381
<xs:choice> and xs:enumeration looks same. How xs:enumeartion fdiffer from xs:cohice ?
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1381
Hi Bartender, Please move this thread to
XML and related Technologies
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
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: 1381
Hi Ivan, can you give examples for allowing two elements inside the <choice> element ?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
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: 1381
Hi Ivan, If i do not give minOccurs and maxOccurs in this line How choice will behave ?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I answer your question with a question:
What are the default values for minOccurs and maxOccurs?
Best wishes!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: xschoice vs xs:enumeration