Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

element all

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the book J2EE Web service 3.1.4.4, 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?

3.1.4.4 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="http://www.w3.org/2001/XMLSchema";
xmlns:mh="http://www.Monson-Haefel.com/jwsbook";
targetNamespace="http://www.Monson-Haefel.com/jwsbook"; >
...
<complexType name="USAddress">
<all>
<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" />
</all>
</complexType>
...
</schema>

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.
 
Rancher
Posts: 3629
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.monson-haefel.com/jws_errata.html

HTH,
MZ
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic