File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes element all 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 "element all" Watch "element all" New topic

element all

George Fung
Ranch Hand

Joined: Jun 12, 2003
Posts: 98
From the book J2EE Web service, the default value of minOccurs is always "0" and maxOccurs is always "1". (occur once or not at all). But default value of minOccurs and maxOcurs are 1 in its example. which one is correct? The all Element
Most of the time you'll base complex types on sequence elements, but occasionally you may want to use the all element. Unlike sequence, which defines the exact order of child elements, the XML schema all element allows the elements in it to appear in any order. 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". Finally, only single elements may be used in an all group; it can't include other groupings like sequence or all. Listing 3-11 shows the schema for the address element using the all element grouping instead of sequence.

Listing 3-11 Using the XML Schema all Element
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=""
targetNamespace="" >
<complexType name="USAddress">
<element name="name" type="string" />
<element name="street" type="string" />
<element name="city" type="string" minOccurs="0"/>
<element name="state" type="string" minOccurs="0"/>
<element name="zip" type="string" />

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. The elements can be in any order, but none of the elements may occur more than once. Listing 3-12 shows a valid instance of the USAddress type as defined using the all element in Listing 3-11.

To be obtained: SCEA 5
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3322


Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Exam 1Z0-810: Upgrade to Java SE 8 Programmer Study Guide and Quiz
I agree. Here's the link:
subject: element all
It's not a secret anymore!