File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes xsd minoccurs=0  defined in xsd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "xsd minoccurs=0  defined in xsd" Watch "xsd minoccurs=0  defined in xsd" New topic

xsd minoccurs=0 defined in xsd

Srinivas Kasani

Joined: Sep 26, 2008
Posts: 22
I had defined in my xsd an element of type xsd:string to be minOccurs=0.
The idea is this is an embedded element in another tag and I don't want this element to appear at all in some instances.
JAXB mappin is used my apache cxf.
Now in java, when I create an new of parent object, the element which I have defined as minOccurs=0 is having a null value.
How to avoid getting this null value, instead I don't want the object to be present at all when I do new of parenet object.

Arun Kumar
Ranch Hand

Joined: Oct 10, 2007
Posts: 30
do not think it can be done.
experts please advise
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
The possibility I see is to analyze the surrounding data structure. Are there special conditions that lead to the absence or presence of the element containing a string?
If so, then it may be possible to define two version of the data structure; one that contains the string element and one that does not.
Best wishes!

My free books and tutorials:
I agree. Here's the link:
subject: xsd minoccurs=0 defined in xsd
It's not a secret anymore!