My apologies. You're very right, I wonder why I had gone down that road.
> -----Original Message----- > From: Christopher Moesel [mailto:[EMAIL PROTECTED] > Sent: Monday, March 26, 2007 1:04 PM > To: [email protected] > Subject: RE: [xfire-user] @XmlElement clarification (slightly OT) > > Actually, minOccurs and maxOccurs both default to 1. So if > you specify neither, you are expecting exactly one occurrence > (and it is not optional). > > http://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints > > -Chris > > -----Original Message----- > From: Karl Palsson [mailto:[EMAIL PROTECTED] > Sent: Monday, March 26, 2007 8:50 AM > To: [email protected] > Subject: RE: [xfire-user] @XmlElement clarification (slightly OT) > > > What in your schema says it's required? > > Unless you have minoccurs=1, then it's not required. (you > can also make > things required with sequences, but let's not go there) > > Minoccurs defaults to 0, not 1. (this is what leads to the world of > hate of nillable and jaxbelement when you try and infer > meaning from the > presence/absence of a tag as well as it's value) > > Cheers, > Karl P > > > -----Original Message----- > > From: Phil Bowker [mailto:[EMAIL PROTECTED] > > Sent: Saturday, March 24, 2007 7:20 PM > > To: [email protected] > > Subject: [xfire-user] @XmlElement clarification (slightly OT) > > > > Using the @XmlElement annotation there is an attribute 'required'. > > I've noticed that if I have an annotated field for which > > there is no value and 'required = true' is NOT set on the > > annotation, then the corresponding XML element is missing > > from the returned document. > > > > I thought at first this was a bug as the XML document > > produced does not conform to the corresponding XSD if the > > element is missing. > > However, the @XmlElement documentation on the Sun site, > > describes the attribute 'required' as: > > > > "Customize the element declaration to be required." > > > > which could be interpreted as, if not set the element itself > > is not required. > > > > I don't understand this as for me the XML document is defined > > by the XSD from which the XML marshalling code is generated. > > > > So, is the behaviour I'm seeing the expected behaviour for > > XFire? Is it the case that any element that must be present > > and may be nillable must have 'required' set to true? > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
