As you say, XJC will only generated an Enum for a Schema type which has
a name, i.e. isn't an anonymous nested type. It doesn't generate enum
types for anonymous schema types - what would it call them?
Potentially, this behaviour could be over-riden, causing XJC to
auto-generate names for anonymous schema types?
Gregory Kick wrote:
> Aha! After some experimentation, I found that it just breaks if the
> simpleType is nested. If I move it outside of the complexType, give
> it it's own name and try it again, it works. Is this a bug or somehow
> justified? Let me know and i'll put into the issue tracker.
>
> On 1/25/07, Gregory Kick <gk5885_at_gmail.com> wrote:
>> Thanks for the quick reply!
>>
>> Yeah, for some reason i'm getting
>>
>> @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
>> protected String type;
>>
>> for
>>
>> <xs:complexType name="Class">
>> <xs:complexContent>
>> <xs:extension base="kse:Named">
>> <xs:sequence>
>> <xs:element name="innerClass" type="kse:Class"
>> minOccurs="0"
>> maxOccurs="unbounded"/>
>> </xs:sequence>
>> <xs:attribute name="type">
>> <xs:simpleType>
>> <xs:restriction base="xs:token">
>> <xs:enumeration value="annotation"/>
>> <xs:enumeration value="enum"/>
>> <xs:enumeration value="class"/>
>> <xs:enumeration value="interface"/>
>> <xs:enumeration value="throwable"/>
>> </xs:restriction>
>> </xs:simpleType>
>> </xs:attribute>
>> </xs:extension>
>> </xs:complexContent>
>> </xs:complexType>
>>
>> On 1/25/07, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>> >
>> > Yes, in fact that's the default behavior.
>> >
>> > I take it that you aren't seeing it though. Can you paste your schema?
>> >
>> > Gregory Kick wrote:
>> > > Is it possible to have
>> > > <xs:restriction base="xs:token">
>> > > <xs:enumeration value="whatever"/>
>> > > ...
>> > > </xs:restriction>
>> > > generate a java 5 enum?
>> > >
>> >
>> >
>> > --
>> > Kohsuke Kawaguchi
>> > Sun Microsystems kohsuke.kawaguchi_at_sun.com
>> >
>> >
>> >
>>
>>
>> --
>> Gregory Kick
>> gk5885_at_gmail.com
>>
>
>