Previously, I was using JAXB 1.04 and had a hack in place to see if fields were set on the JAXB Types. For example, say I have an element with attribute "foo" set to boolean type like so:

<xsd:complexType name="elementType">
   <xsd:attribute name="foo" type="xsd:boolean" />
</xsd:complexType>

When I got a reference to elementType and executed isFoo(), I would get a "false" regardless if foo was set in the XML or not.

Luckily, the Sun JAXB implementation of ElementTypeImpl had fields that were protected -- specifically, a "has_Foo" field. So, I just hacked together a JAXBUtil class that sat in the same package as my generated JAXB classes. Then, I would use JAXBUtil to see if the "has_Foo" field was set.

Unfortunately, I'm getting the same results with JaxMe, primitives are set to their default. However, the fields in ElementTypeImpl are private. So, my hack no longer works. (Also, the field names are different, but's not a big deal.)

I'm in a pickle here because I have to have datatypes set in the XSD (can't use string) because of our existing code. Of course, I can write a perl script to change the fields to protected or public and go back to my previous hack, but that kind of sucks.

*****

After comparing the JAXB and JaxMe generated classes, it seems that there is an extra field in the JAXB classes called "has_Foo". Here's what setFoo() looks like:

   public void setFoo(boolean value) {
       _Foo = value;
       has_Foo = true;
   }

Any suggestions would be great.

Thanks!

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to