Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

xsd minoccurs=0 defined in xsd

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do not think it can be done.
experts please advise
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic