Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question using XSD with JAXB

 
Scott McGhee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic