Skip to main content

Missing setter method when maxoccurs="unbound" is present

3 replies [Last post]
scorpkiran
Offline
Joined: 2005-03-08
Points: 0

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:

.......

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09
Points: 0

Sounds like you are using JAXB 1.0.
If so, this is a forum for JAXB 2.0. Please direct your 1.0 related questions to users@jaxb.dev.java.net. Note that you need to subscribe before you post from http://jaxb.dev.java.net/

karu_java
Offline
Joined: 2006-05-23
Points: 0

Missing setter method when maxoccurs="unbound"

Is there any fix for this? We are using jwsdp1.6

karu_java
Offline
Joined: 2006-05-23
Points: 0

Sorry, Slution is there in the source file itself in the form of comments!!!

* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set method for the OrderEntryLineItems property.
*
*

* For example, to add a new item, do as follows:
*

     *    getOrderEntryLineItems().add(newItem);
     *