users@jaxb.java.net

restriction attribute handling

From: Johnny Tolliver <jxt_at_ornl.gov>
Date: Wed, 28 Sep 2005 13:48:46 -0400 (EDT)

Hi. I am a total newbie with JAXB. I hope someone here an help me with what
seems like a simple problem.

It seems that the restriction attribute isn't handled correctly in JAXB. Using
the generated java classes, I can set the value to anything rather than just
the restricted list. I found in the list archives an identical complaint from
2003 with a reply to change the base type to XSD:NCName.

Well, I've got two problems with that solution. First, I'm using a public
standard published schema (OASIS CAP 1.0) and it just doesn't seem right to go
in and change it.

Second, even if I do change the base type to NCName, my very simple code can
still set the value to anything.

The XMLBeans approach is to force you to choose one of a subclass of
org.apache.xmlbeans.StringEnumAbstractBase. This works but is somewhat uglier.

Is there a modern (2005) solution to this problem? Thanks.

Johnny S. Tolliver
Oak Ridge National Laboratory
tolliverjs_at_ornl.gov, 865-574-1305