You're right, I'd just taken a very quick look before responding and 
misinterpreted the code. What's actually going on is that trimXName() is 
being called twice. This first time is in the CodeGen code itself, and 
the result of this first call is being passed in to the toBaseName() 
name converter method - which then calls trimXName() again.

Recursive removal would make some sense... but it's easy enough to 
implement recursion in a custom trimXName() implementation if that's 
what someone wants. Two removal passes does not make sense. I've changed 
it for 1.2.2 so that CodeGen will pass the name to toBaseName() without 
calling trimXName() itself.

  - Dennis


Caristi, Joe wrote:
> It seems like the recursion is not in the trimXName method.  Even so, I went 
> ahead and tried a simple subclass, and it also turned out to be recursive.  
> The trimXName method is being called multiple times for each element.  Based 
> on this, it seems like I would need to override a method somewhere else.
>
> -----Original Message-----
> From: Dennis Sosnoski [mailto:d...@sosnoski.com]
> Sent: Saturday, September 26, 2009 12:45 AM
> To: JiBX users
> Subject: Re: [jibx-users] strip-suffixes is recursive?
>
> This is by design, since some schemas use combinations of added words in
> different orders. It'd be possible to write the code so that it would
> only remove at most one instance of each suffix, but that seems more
> trouble than it's worth.
>
> You should be able to easily change this behavior with a trivial
> subclass of DefaultNameConverter - just override trimXName(String) and
> do it your way.
>
>   - Dennis
>
> Dennis M. Sosnoski
> XML and Web Services in Java
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
> jcaristi wrote:
>   
>> In attempting to use the strip-suffixes codegen option to remove the word
>> "Type" from the end of my complex types.  However, some of my complex types
>> have the word "Type" in the name as well as a "Type" suffix.  In this case,
>> JiBX seems to recursively remove the suffix.  In the following example, I
>> would expect to end up with "VehicleType" and "Vehicle".  Instead, I end up
>> with "Vehicle" (two instances of "Type" removed) and "Vehicle1" (one
>> instances of "Type" removed and class renamed to avoid conflict).  This is
>> definitely not what I want.
>>
>> Is this by design?  Is there a way around this or do I have to code my own
>> name converter?
>>
>> <xsd:complexType name="VehicleTypeType">
>>               <xsd:simpleContent>
>>                       <xsd:extension base="xsd:string">
>>                               <xsd:attribute name="Id" type="xsd:int" 
>> use="required" />
>>                       </xsd:extension>
>>               </xsd:simpleContent>
>>       </xsd:complexType>
>>
>> <xsd:complexType name="VehicleType">
>>               <xsd:simpleContent>
>>                       <xsd:extension base="xsd:string">
>>                               <xsd:attribute name="Id" type="int" 
>> use="required" />
>>                       </xsd:extension>
>>               </xsd:simpleContent>
>>       </xsd:complexType>
>>
>>
>>
>>     
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
> STATEMENT OF CONFIDENTIALITY:
>
>
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and may
> contain confidential or privileged information. If you are not the intended
> recipient, please notify WHI Solutions immediately at g...@whisolutions.com,
> and destroy all copies of this message and any attachments.
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to