Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

all element query  RSS feed

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peers, need to check the source...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!