You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Stevo Slavić <ss...@gmail.com> on 2012/06/29 10:01:47 UTC

Handling enumerations with diacritics

Hello Apache CXF community,

An XSD/WSDL (Dutch StUF standard) uses diacritics in string enumerations.
I'm using cxf-codegen-plugin to generate code from it. Resulting enum
member names have invalid characters.

Is there any extension or configuration option for cxf-codegen-plugin or
xjc to replace these characters to characters without diacritics just for
the (enum member) names? Values are already correctly being generated as
UTF-8 characters.

One solution I'd like to avoid is to use ISO-8859-1 for source encoding.

Kind regards,
Stevo Slavić.

Re: Handling enumerations with diacritics

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, July 02, 2012 11:46:36 PM Stevo Slavić wrote:
> Great, thanks all for the heads up.
> 
> Target is Java 7. Since my target runtime also includes JBoss AS 7.1.1
> which provides CXF 2.4.6, is it possible to use newer cxf-codegen-plugin
> with such older runtime?

It should work fine.  However, you *MAY* need to move the call to the maven 
plugin into a separate Maven module that does not import any CXF 
dependencies.   Otherwise, the 2.6 codegen plugin may try pulling in the 2.4 
deps and cause weird conflicts and such.    If you put all of that into a 
dedicated module, you should be all set.   The generated code itself should 
be completely compatible.

Dan



> 
> Kind regards,
> Stevo.
> 
> On Mon, Jul 2, 2012 at 9:25 PM, Daniel Kulp <dk...@apache.org> wrote:
> > On Monday, July 02, 2012 07:23:45 AM Glen Mazza wrote:
> > > For data types, the enums are generated by the (Oracle) JAXB that CXF
> > > tasks the Java class generation to, I don't know of anything CXF can
> > > do
> > > to override that.
> > 
> > Kind of true.  With 2.6.1, we DID add an -encoding flag to wsdl2java
> > that
> > we
> > can sometimes set to let wsdl2java know what encoding to generate.
> > HOWEVER, this requires the VERY latest JAXB 2.2 code.  For java6, that
> > then requires endorsing the jaxb-api, reconfiguring the plugin to pull
> > in the 2.2
> > versions, etc...  It should work fine with java5 and java7 though.
> > 
> > Dan
> > 
> > > Have you thought of preprocessing your WSDL (search and replace if you
> > > have to) prior to running cxf-codegen-plugin?  I would suspect most in
> > > your shoes would do that, resulting in CXF never having a need to
> > > implement a remapping to remove diacritics.
> > > 
> > > Glen
> > > 
> > > On 6/29/2012 4:01 AM, Stevo Slavić wrote:
> > > > Hello Apache CXF community,
> > > > 
> > > > An XSD/WSDL (Dutch StUF standard) uses diacritics in string
> > > > enumerations.
> > > > I'm using cxf-codegen-plugin to generate code from it. Resulting
> > > > enum
> > > > member names have invalid characters.
> > > > 
> > > > Is there any extension or configuration option for
> > > > cxf-codegen-plugin
> > 
> > or
> > 
> > > > xjc to replace these characters to characters without diacritics
> > > > just
> > > > for
> > > > the (enum member) names? Values are already correctly being
> > > > generated
> > 
> > as
> > 
> > > > UTF-8 characters.
> > > > 
> > > > One solution I'd like to avoid is to use ISO-8859-1 for source
> > 
> > encoding.
> > 
> > > > Kind regards,
> > > > Stevo Slavić.
> > 
> > --
> > Daniel Kulp
> > dkulp@apache.org - http://dankulp.com/blog
> > Talend Community Coder - http://coders.talend.com
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Handling enumerations with diacritics

Posted by Stevo Slavić <ss...@gmail.com>.
Great, thanks all for the heads up.

Target is Java 7. Since my target runtime also includes JBoss AS 7.1.1
which provides CXF 2.4.6, is it possible to use newer cxf-codegen-plugin
with such older runtime?

Kind regards,
Stevo.

On Mon, Jul 2, 2012 at 9:25 PM, Daniel Kulp <dk...@apache.org> wrote:

> On Monday, July 02, 2012 07:23:45 AM Glen Mazza wrote:
> > For data types, the enums are generated by the (Oracle) JAXB that CXF
> > tasks the Java class generation to, I don't know of anything CXF can do
> > to override that.
>
> Kind of true.  With 2.6.1, we DID add an -encoding flag to wsdl2java that
> we
> can sometimes set to let wsdl2java know what encoding to generate.
> HOWEVER, this requires the VERY latest JAXB 2.2 code.  For java6, that then
> requires endorsing the jaxb-api, reconfiguring the plugin to pull in the
> 2.2
> versions, etc...  It should work fine with java5 and java7 though.
>
> Dan
>
>
> >
> > Have you thought of preprocessing your WSDL (search and replace if you
> > have to) prior to running cxf-codegen-plugin?  I would suspect most in
> > your shoes would do that, resulting in CXF never having a need to
> > implement a remapping to remove diacritics.
> >
> > Glen
> >
> > On 6/29/2012 4:01 AM, Stevo Slavić wrote:
> > > Hello Apache CXF community,
> > >
> > > An XSD/WSDL (Dutch StUF standard) uses diacritics in string
> > > enumerations.
> > > I'm using cxf-codegen-plugin to generate code from it. Resulting enum
> > > member names have invalid characters.
> > >
> > > Is there any extension or configuration option for cxf-codegen-plugin
> or
> > > xjc to replace these characters to characters without diacritics just
> > > for
> > > the (enum member) names? Values are already correctly being generated
> as
> > > UTF-8 characters.
> > >
> > > One solution I'd like to avoid is to use ISO-8859-1 for source
> encoding.
> > >
> > > Kind regards,
> > > Stevo Slavić.
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: Handling enumerations with diacritics

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, July 02, 2012 07:23:45 AM Glen Mazza wrote:
> For data types, the enums are generated by the (Oracle) JAXB that CXF
> tasks the Java class generation to, I don't know of anything CXF can do
> to override that.

Kind of true.  With 2.6.1, we DID add an -encoding flag to wsdl2java that we 
can sometimes set to let wsdl2java know what encoding to generate.   
HOWEVER, this requires the VERY latest JAXB 2.2 code.  For java6, that then 
requires endorsing the jaxb-api, reconfiguring the plugin to pull in the 2.2 
versions, etc...  It should work fine with java5 and java7 though.

Dan


> 
> Have you thought of preprocessing your WSDL (search and replace if you
> have to) prior to running cxf-codegen-plugin?  I would suspect most in
> your shoes would do that, resulting in CXF never having a need to
> implement a remapping to remove diacritics.
> 
> Glen
> 
> On 6/29/2012 4:01 AM, Stevo Slavić wrote:
> > Hello Apache CXF community,
> > 
> > An XSD/WSDL (Dutch StUF standard) uses diacritics in string
> > enumerations.
> > I'm using cxf-codegen-plugin to generate code from it. Resulting enum
> > member names have invalid characters.
> > 
> > Is there any extension or configuration option for cxf-codegen-plugin or
> > xjc to replace these characters to characters without diacritics just
> > for
> > the (enum member) names? Values are already correctly being generated as
> > UTF-8 characters.
> > 
> > One solution I'd like to avoid is to use ISO-8859-1 for source encoding.
> > 
> > Kind regards,
> > Stevo Slavić.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Handling enumerations with diacritics

Posted by Glen Mazza <gm...@talend.com>.
For data types, the enums are generated by the (Oracle) JAXB that CXF 
tasks the Java class generation to, I don't know of anything CXF can do 
to override that.

Have you thought of preprocessing your WSDL (search and replace if you 
have to) prior to running cxf-codegen-plugin?  I would suspect most in 
your shoes would do that, resulting in CXF never having a need to 
implement a remapping to remove diacritics.

Glen

On 6/29/2012 4:01 AM, Stevo Slavić wrote:
> Hello Apache CXF community,
>
> An XSD/WSDL (Dutch StUF standard) uses diacritics in string enumerations.
> I'm using cxf-codegen-plugin to generate code from it. Resulting enum
> member names have invalid characters.
>
> Is there any extension or configuration option for cxf-codegen-plugin or
> xjc to replace these characters to characters without diacritics just for
> the (enum member) names? Values are already correctly being generated as
> UTF-8 characters.
>
> One solution I'd like to avoid is to use ISO-8859-1 for source encoding.
>
> Kind regards,
> Stevo Slavić.
>


-- 
Glen Mazza
Talend Community Coder
http://coders.talend.com


Re: Handling enumerations with diacritics

Posted by Jim Talbut <jt...@spudsoft.co.uk>.
Just a thought, but are you sure that the files that cxf-codegen-plugin creates are being read as UTF8?
Even if they are valid UTF8 files you still need to tell the compiler that.

Him

On 29 Jun 2012, at 09:01, Stevo Slavić <ss...@gmail.com> wrote:

> Hello Apache CXF community,
> 
> An XSD/WSDL (Dutch StUF standard) uses diacritics in string enumerations.
> I'm using cxf-codegen-plugin to generate code from it. Resulting enum
> member names have invalid characters.
> 
> Is there any extension or configuration option for cxf-codegen-plugin or
> xjc to replace these characters to characters without diacritics just for
> the (enum member) names? Values are already correctly being generated as
> UTF-8 characters.
> 
> One solution I'd like to avoid is to use ISO-8859-1 for source encoding.
> 
> Kind regards,
> Stevo Slavić.