• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question using XSD with JAXB

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on a project which currently has the following XSD defined:So one may see XML similar to this:But now we want to change the schema such that the following will be possibleBut I'm having trouble figuring out how to modify the XSD. I was thinking something like this:Can someone give me some advise?
 
Scott McGhee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some more notes here.

My issue is that I think the XSD is thinking the "value" element inside the label complex type is treated as a sub-tag and not the actual value of the tag - like it would expect thisinstead of thisOr maybe I'm mistaken?

When using this XSD to generate java code, I'm expecting to get a Label.java with a getter/setter for "value" to set the text inside the <label> tag.

I also want the XSD to be completely backwards compatible, so any existing XMLs in the database will not fail to parse.
 
Scott McGhee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I gave up and read an XSD tutorial and figured out what to do on my own. Here is the final XSD that worked like I wanted it to.
 
Quick! Before anybody notices! Cover it up with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic