users@jaxb.java.net

Re: typesafe enumeration

From: _Eric_ <E.Haertel_at_d-trust.net>
Date: Thu, 17 Jul 2008 00:44:26 -0700 (PDT)

The XSD is an agreement with a partner, so I would not like to chnge
anything. To put a anotation is no problem, but I avoid everything else. But
I will check this.

Thanks for the hint


Kenny MacLeod wrote:
>
> try using xs:NMTOKEN instead of xs:string as the base of your type. xjc
> should then generate an enum type, and it won't need the appinfo to do it.
>
> _Eric_ wrote:
>> Hi list,
>>
>> I have a problem with enumerations. See this peace of XSD:
>> <xs:element name="Sex">
>> <xs:simpleType>
>> <xs:annotation>
>> <xs:appinfo>
>> <jaxb:typesafeEnumClass
>> name="sex">
>> <jaxb:typesafeEnumMember
>> name="MALE" value="MALE" />
>> <jaxb:typesafeEnumMember
>> name="FEMALE" value="FEMALE" />
>> </jaxb:typesafeEnumClass>
>> </xs:appinfo>
>> </xs:annotation>
>> <xs:restriction base="xs:string">
>> <xs:enumeration value="MALE" />
>> <xs:enumeration value="FEMALE" />
>> </xs:restriction>
>> </xs:simpleType>
>> </xs:element>
>>
>> I would expect an Java-Enumeration is generated but nothing happens. The
>> property of "Sex" is plain Sting :-( Does anybody see someting wrong
>> here?
>>
>> The schema is included into an WSDL and I compile with Maven2 with the
>> following configuration:
>> <plugin>
>> <groupId>org.apache.cxf</groupId>
>>
>> <artifactId>cxf-codegen-plugin</artifactId>
>> <version>${cxf.version}</version>
>> <executions>
>> <execution>
>> <id>generate-sources</id>
>>
>> <phase>generate-sources</phase>
>> <goals>
>>
>> <goal>wsdl2java</goal>
>> </goals>
>> <configuration>
>> <sourceRoot>
>>
>> ${basedir}/target/generated/src/main/java
>> </sourceRoot>
>> <wsdlOptions>
>>
>> <wsdlOption>
>>
>> <wsdl>${basedir}/src/main/webapp/WEB-INF/service.wsdl</wsdl>
>>
>> <extraargs>
>>
>> <extraarg>-wsdlLocation</extraarg>
>>
>> <extraarg>WEB-INF/service.wsdl</extraarg>
>>
>> </extraargs>
>>
>> </wsdlOption>
>> </wsdlOptions>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>> Greetings Eric
>> --
>> View this message in context:
>> http://www.nabble.com/typesafe-enumeration-tp18468806p18468806.html
>> Sent from the java.net - jaxb users mailing list archive at Nabble.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
>
>
>

-- 
View this message in context: http://www.nabble.com/typesafe-enumeration-tp18468806p18503283.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.