Skip to main content

@XmlElementWrapper(required = true) has no effect

1 reply [Last post]
rbfield
Offline
Joined: 2007-05-02

According to the javadocs, specifying required = true on an element wrapper should make the wrapper element required (minOccurs = 1) in the generated schema. This doesn't appear work in JAXB 2.1.3. Is it supposed to?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mshaffer55
Offline
Joined: 2007-02-07

I guess that depends on how you look at it. The default value for minOccurs is always 1, so actually adding minOccurs="1" as an element attribute in the schema is really a no-op of sorts. Whether it is present or not wouldn't affect validation, for example.