users@jaxb.java.net

Re: Setter method for maxoccurs="unbound" element

From: Bhakti Mehta <Bhakti.Mehta_at_Sun.COM>
Date: Tue, 08 Mar 2005 13:43:33 -0800

Hi Kiran,
The accessor method getNewAccount returns a live list. Any modifications
made to the list will be present in the JAXB object. hence there is no
setter method. Once you remove the maxOccurs ="unbounded" you therefore
get the setter method

Regards,
Bhakti

Kiran Devaram wrote:

> Hello All,
>
>I was able to successfully generate classes from xsd.
>But, while using the generated classes for create a
>content tree and marshall it to xml, I faced problems.
>I am unable to find the setter method for the root
>element. Below is the xsd for which I faced problem.
>Please take a look at the maxOccurs="unbounded" line.
>
>code:
>
>
><xsd:element name="InstallService">
><xsd:complexType>
><xsd:sequence maxOccurs="unbounded">
><xsd:choice>
><xsd:element name="NewAccount"
>type="AccountRecordType">
>.......
>
>
>
>
>With the above xsd, XJC generated a class with
>InstallServiceType interface having getNewAccount()
>and inner interface NewAccount. But what it lacked is
>setNewAccount(NewAccount). Without this element, I
>cannot marshall a java object to xml.
>
>But, when I removed the maxOccurs="unbounded", xjc
>created InstallServiceType with the setter method
>setNewAccount(..).
>
>Is this the problem with JAXB or is it with my schema?
>Any help or pointers is appreciated.
>
>Thank you,
>Kiran
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>