users@jaxb.java.net

RE: Integer in Enumeration value

From: Sam Cheung <sylcheung_at_hotmail.com>
Date: Mon, 16 Feb 2004 21:13:35 +0000

Rob,

Thank you for your help.

I appreciate it .

Thanks again.

Sam


>From: "Robert Lowe" <rmlowe_at_rmlowe.com>
>Reply-To: users_at_jaxb.dev.java.net
>To: <users_at_jaxb.dev.java.net>
>Subject: RE: Integer in Enumeration value
>Date: Tue, 17 Feb 2004 02:40:09 +0800
>
>Right, because the default bindings would be something like:
>
>public static final MyType 5_6_0 = ...;
>public static final MyType 5_5_0 = ...;
>public static final MyType 5_3_0 = ...;
>
>But those aren't legal Java identifiers because they start with digits. So
>I
>guess you need to use the <typesafeEnumMember> declaration to assign legal
>names to each member of the enum, so you get e.g.:
>
>public static final MyType V5_6_0 = ...;
>public static final MyType V5_5_0 = ...;
>public static final MyType V5_3_0 = ...;
>
>
>Best regards,
>
>Robert Lowe
>http://RMLowe.com/
>
>
>-----Original Message-----
>From: Sam Cheung [mailto:sylcheung_at_hotmail.com]
>Sent: Monday, February 16, 2004 5:11 AM
>To: users_at_jaxb.dev.java.net
>Subject: RE: Integer in Enumeration value
>
>
>
>Thanks. I put this in my binding file, and
><jxb:globalBindings
> typesafeEnumBase="xs:string"/>
>
>and change the base to "xs:string" in my enumeration base.
><xs:restriction base="xs:string">
> <xs:enumeration value="5.6.0" />
> <xs:enumeration value="5.5.0" />
> <xs:enumeration value="5.3.0" />
> </xs:restriction>
>
>but I get this error instead:
>
> [xjc] [ERROR] Cannot derive a valid Java identifier from "5.6.0".
>Specify a customization to change the name.
> [xjc] line 384 of REL-5-MM7-1-3.xsd.out
> [xjc] [ERROR] Cannot derive a valid Java identifier from "5.5.0".
>Specify a customization to change the name.
> [xjc] line 384 of REL-5-MM7-1-3.xsd.out
> [xjc] [ERROR] Cannot derive a valid Java identifier from "5.3.0".
>Specify a customization to change the name.
> [xjc] line 384 of REL-5-MM7-1-3.xsd.out
>
>
> >From: "Robert Lowe" <rmlowe_at_rmlowe.com>
> >Reply-To: users_at_jaxb.dev.java.net
> >To: <users_at_jaxb.dev.java.net>
> >Subject: RE: Integer in Enumeration value
> >Date: Mon, 16 Feb 2004 04:21:56 +0800
> >
> > > > Do you know if there is a way for jaxb to generate a strong type
>enum
> > > java
> > > > class for enum values such as "5.0.1." , "5.0.2", "5.0.3"?
> > >
> > > I'm pretty sure there's a binding customization that will do it, but I
> >don't
> > > remember the details. Check the spec and/or the docs for the reference
> > > inplementation.
> >
> >Got it--it's the typesafeEnumBase option--see section 6.5 of the spec.
> >
> >
> >Best regards,
> >
> >Robert Lowe
> >http://RMLowe.com/
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> >For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> >For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
>
>_________________________________________________________________
>Create your own personal Web page with the info you use most, at My MSN.
>http://click.atdmt.com/AVE/go/onm00200364ave/direct/01/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>

_________________________________________________________________
Get some great ideas here for your sweetheart on Valentine's Day - and
beyond. http://special.msn.com/network/celebrateromance.armx


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net