Vallamshettla, Anand wrote:
> JAXB seems to set a property value to 'null' in the following cases
>
>
>
> 1) <element xsi:nil="true"></element> is in XML doc.
>
> 2) <elemtent> tag is not in the XML doc.
>
>
>
> Is there a way in JAXB 1.0 to differentiate those 2 cases? (May be
some
> customization???)
I think this should work in 2.0 by using the JAXBElement class, but not
sure for 1.0.
>>> Could you please explain a little bit more on how it can be done in
JAXB 2.0? I added JAXB 2.0 generated class at the bottom. How can we
determine whether "MiddleInitial" is set to nil. (Only the root element
is JAXBElement - which I can determine whether it is set nil).
You might try enabling the type substitution support, which changes the
binding somewhat, and it might allow you to do so.
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
------------------------------------------------------------------------
-
@javax.xml.bind.annotation.XmlType(name = "NameType", namespace =
"urn:org:pesc:sector:Aid-Delivery-FFEL:v1.0.2")
public class NameType {
@javax.xml.bind.annotation.XmlElement(name = "FirstName", namespace
= "", type = java.lang.String.class)
protected java.lang.String _FirstName;
@javax.xml.bind.annotation.XmlElement(name = "MiddleInitial",
namespace = "", nillable = true, type = java.lang.String.class)
protected java.lang.String _MiddleInitial;
@javax.xml.bind.annotation.XmlElement(name = "LastName", namespace =
"", type = java.lang.String.class)
protected java.lang.String _LastName;
/**
* Gets the value of the firstName property.
*
* @return
* possible object is
* {_at_link java.lang.String}
*/
@javax.xml.bind.annotation.XmlTransient
public java.lang.String getFirstName() {
return _FirstName;
}
/**
* Sets the value of the firstName property.
*
* @param value
* allowed object is
* {_at_link java.lang.String}
*/
public void setFirstName(java.lang.String value) {
_FirstName = value;
}
/**
* Gets the value of the middleInitial property.
*
* @return
* possible object is
* {_at_link java.lang.String}
*/
@javax.xml.bind.annotation.XmlTransient
public java.lang.String getMiddleInitial() {
return _MiddleInitial;
}
/**
* Sets the value of the middleInitial property.
*
* @param value
* allowed object is
* {_at_link java.lang.String}
*/
public void setMiddleInitial(java.lang.String value) {
_MiddleInitial = value;
}
/**
* Gets the value of the lastName property.
*
* @return
* possible object is
* {_at_link java.lang.String}
*/
@javax.xml.bind.annotation.XmlTransient
public java.lang.String getLastName() {
return _LastName;
}
/**
* Sets the value of the lastName property.
*
* @param value
* allowed object is
* {_at_link java.lang.String}
*/
public void setLastName(java.lang.String value) {
_LastName = value;
}
}