Thanks. One more question: What version of JAXB supports such global
binding option ?
I currently have JWSDP v1.2 that comes with JAXB 1.0.1
if (getYYY != null) {
// the attribute was present in the original document
setYYY(null); // this will "clear" the attribute
}
A more elegant approach would be to add the isSet and unset methods via
the global binding
<jxb:globalBindings generateIsSetMethod="true"/>
This will add the isSetYYY() and unsetYYY() methods so you could then do
if (isSetYYY()) {
unsetYYY();
}
Adolfo
-----Original Message-----
From: Jorge Medina [mailto:Jorge_Medina_Ang_Collan_at_symantec.com]
Sent: Thursday, May 20, 2004 12:52 PM
To: users_at_jaxb.dev.java.net
Subject: optional attributes
I have defined some entities with optional attributes with no default
value.
Lets assume the attribute is called YYY
I get the setYYY/getYYY methods on the generated interfaces.
a) Is there any way I could know if the attribute was in fact present in
the original document ?
b) Is there any way to "clear" the attribute so that it is not generated
to the xml document ?
Thanks.
-Jorge