users@jaxb.java.net

Re: Error: attribute hat bad value: get the valid enumeration???

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 04 Jun 2003 08:59:11 -0700

Christoph Brunner <news_chbr0001_at_YAHOO.DE> wrote:
> In my Schema i have defined an enumeration of valid values for a specific tag-attribute.
> If i manipulate this value in an example xml File to an invalid value, so the unmarshalling with JAXB get me this error:
> attribute "V" has a bad value: the value is not a member of the enumeration.
> Is there a possibility to get the enumeration in Java, so i can say the user which values are valid?

Currently, the only way to do this is through the reflection API. You
can enumerate all static fields of a type-safe enum class and look for
fields whose type is the type-safe enum class.

I think this is one of the frequently requested features, so hopefully
the next rev of the spec will address this issue.

regards,
--
Kohsuke Kawaguchi                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com