I got this from the JAXB doc for @XmlElement
If required() is true, then Javabean
property is mapped to an XML schema
element declaration with
minOccurs=”1″. maxOccurs is “1” for a
single valued property and “unbounded”
for a multivalued property.
However when I say
@XmlElement(name = "Name", required = true, nillable = false)
I get the following in the .xsd
<xs:element name="Name" type="xs:string"/>
I wonder how I can make minOccurs to equal to 1. It seems like required = true causes minOccurs to disappear
Edit
I realize that the default value is 1. Is there anyway to for minOccurs to show up as 1 in the .xsd
Edit2
I am using JAXBContext.generateSchema to generate the schema (FYI)
The JAXB spec defines the behaviour:
The indivual implementations (Metro, EclipseLink MOXy, Apache JaxMe) are free to generate the XML schema as they see fit according to this rule. Metro and MOXy (I’m the tech lead) choose to use the absence of the minOccurs attribute to indicate minOccurs=”1″.