users@jaxb.java.net

setter or add method for collections

From: Shashi Garje <SGarje_at_cccis.com>
Date: Tue, 13 May 2003 14:23:43 -0500

Hi
This looks like a basic topic that must have been discussed a year ago but
I was not able to find anything in the archive.

I have the equivalent of a hashmap which I represent using the xsd

<xsd:complexType name="HashMap">
            <xsd:sequence>
                  <xsd:element name="entry" type="internal:Entry" minOccurs
="0" maxOccurs="unbounded" />
            </xsd:sequence>

      </xsd:complexType>
      <xsd:complexType name="Entry">
            <xsd:sequence>
                  <xsd:element name="key" type="xsd:string"/>
                  <xsd:element name="value" type="xsd:string"/>
            </xsd:sequence>
      </xsd:complexType>

When I generated the Java classes using JAXB it generated only a getter for
the List of Entry objects
java.util.List getEntry();
It did not generate a setter or an add method. I would like to generate the
object programmatically and then marshal it to XML.
Please let me know how that can be done.
Thanks