You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by "Hiller, Dean" <DH...@carrieraccess.com> on 2006/11/13 17:05:37 UTC
primitives(was on email archives but more questions)
I have an xsd with an attribute....
<xs:element name="id" type="xs:long" minOccurs="0">
I incorrectly assumed this would result in a Reference object like Long OR
would have a isSet() method. There seems to be no way to tell that the id
was actually set. I did see a post that suggest the following....
<xsd:attribute name="foo" type="xsd:boolean">
<xsd:annotation><xsd:appinfo>
<jaxb:property>
<jxb:baseType><jxb:javaType
name="java.lang.Boolean"/></jxb:baseType>
</jaxb:property>
</xsd:appinfo></xsd:annotation>
</xsd:attribute>
BUT I am wondering why I need that since minOccurs="0". My app then
receives the jaxme object and id is always set to 0 which is not what the
person who sent me the object intended....they may have wanted it to be
null.as
Later,
dean
Re: primitives(was on email archives but more questions)
Posted by Robert Eric Reeves <ro...@phurnace.com>.
Add this to your XSD to get the isSet() method:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb">
<xsd:annotation>
<xsd:appinfo>
<jxb:globalBindings generateIsSetMethod="true">
</jxb:globalBindings>
</xsd:appinfo>
</xsd:annotation>
Hiller, Dean wrote:
>
> I have an xsd with an attribute….
>
> <xs:element name="id" type="xs:long" minOccurs="0">
>
> I incorrectly assumed this would result in a Reference object like
> Long OR would have a isSet() method. There seems to be no way to tell
> that the id was actually set. I did see a post that suggest the
> following….
>
> <xsd:attribute name="foo" type="xsd:boolean">
> <xsd:annotation><xsd:appinfo>
> <jaxb:property>
> <jxb:baseType><jxb:javaType
> name="java.lang.Boolean"/></jxb:baseType>
> </jaxb:property>
> </xsd:appinfo></xsd:annotation>
> </xsd:attribute>
>
> BUT I am wondering why I need that since minOccurs=”0”. My app then
> receives the jaxme object and id is always set to 0 which is not what
> the person who sent me the object intended….they may have wanted it to
> be null.as
>
> Later,
>
> dean
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org