aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes all element query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "all element query" Watch "all element query" New topic
Author

all element query

Abhishek Dharwadkar
Ranch Hand

Joined: Aug 02, 2006
Posts: 44
In the RMH book it says
Each element in an all group may occur once or not at all; no other multiplicity is allowed. In other words, minOccurs is always "0" and maxOccurs is always "1".


Below is the part of valid schema


And below is a xml document instance to the above schema


Now, the book says the below about the xml doc instance
In Listing 3-11 the name, street, and zip elements must be present in the instance document, but the city and state elements may be absent.


My question is:
When they say minOccurs is always "0" and maxOccurs is always "1", how can they say that in the xml doc the name, street, and zip elements must be present in the instance document?


"I may not have gone where I intended to go, but I think I have ended up where I needed to be"<br /> <br />"He felt that his whole life was some kind of dream and he sometimes wondered whose it was and whether they were enjoying it"<br /> <br />--by Douglas Adams<br /> <br />[SCJP - 96%, SCWCD - 88%, SCBCD - May 2008]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Abhishek Dharwadkar:
In the RMH book it says...


It doesn't. Apparently your source is compromised.

RMH states (p48):

Each element in an all group may occur once or not at all; no other multiplicity is allowed. In other words, minOccurs is either "0" or "1" (the default is "1") and maxOccurs is always "1".


So in "all" each element is required unless it states 'minOccurs="0"'.
Abhishek Dharwadkar
Ranch Hand

Joined: Aug 02, 2006
Posts: 44
Thanks Peers, need to check the source...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: all element query