users@jaxb.java.net

Re: unmarshal/marshal discrepancy with attribute

From: Marc Dumontier <dumontier_at_mshri.on.ca>
Date: Wed, 08 Jan 2003 14:34:42 -0500

The "fix" was to make the attribute required, once that is done, JAXB
will write out the attribute during a marshal call. The problem still
remains that although the attribute was optional, and it was being read
in, it wasn't being written.


public interface BINDExperimentalSystem1 {
    java.util.List getValue();
}


   public void
serializeAttributes(com.sun.xml.bind.serializer.XMLSerializer context)
        throws org.xml.sax.SAXException
    {
        int idx1 = 0;
        final int len1 = _Value.size();
        idx1 += 1;
        context.startAttribute("", "value");
        context.text(((String) _Value.get(idx1 ++)));
        context.endAttribute();
    }


Marc Dumontier

Kohsuke Kawaguchi wrote:

>Thank you for a bug report.
>
>It looks like the problem is because of a name collision. What is the
>method signature of the generated class BINDExperimentalSystem1?
>
>Does it have two accessors or four accessors? Could you change the name
>of the value attribute to something else (like "xyz") to see if the
>problem still reproduces?
>
>
>regards,
>--
>Kohsuke KAWAGUCHI 408-276-7063 (x17063)
>Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>