Hi,

the main problem is that - for element generation mode - Castor
establishes a sort of strange class hierarchy, which could cause
problems in many places for a toString() implementation.

I am not saying that it is not possible, but it is going to be
non-straight-forward.

Kind Regards
Werner

On 30.06.2011 17:31, Papendieck, Thomas wrote:
> Hello Ralf,
> 
> I admit the problem is for convenience...
> 
> My usecase is as follows:
> DTD: 
>    <!ELEMENT Root (Container+, OtherRequiredElementsOutOfMyFocus)>
>    <!ELEMENT Container (Content1+)>
>    <!ELEMENT Content (#PCDATA)>
> 
> I'm creating  Container and Content Elements by parsing a non XML file. My 
> parser returns 'List<Container>'.
> 
> I generated the classes with option 
> "org.exolab.castor.builder.equalsmethod=true".
> 
> This I can just do 
> Assert.assertThat("list with one Object returned"
>     , new MyParser().parse("sampleString")
>     , is(Arrays.asList(new Container[] {contentDummy})));
> 
> But when this fails the output of JUnit does not tell enything meaningfull 
> unless "toString()" is implemented.
> 
> Actually I have Eclipse generating "toString()" but there is no bulk 
> operation for this and it would have been done again after regeneration 
> castor generated sources...
> 
> bye
> Thomas
> 
> ________________________________________
> Von: Ralf Joachim [[email protected]]
> Gesendet: Donnerstag, 30. Juni 2011 15:51
> Bis: [email protected]
> Betreff: Re: [castor-user] XML - how to generate toString() ?
> 
> Hello Thomas,
> 
> how about setting indent and other properties to a specific value for
> your tests programmatically while using the values from
> castor.properties for production.
> 
> Regards
> Ralf
> 
> Am 30.06.2011 15:28, schrieb Papendieck, Thomas:
>> Hello Ralf,
>>
>>> why you do not simply marshal them when you need a string representation of 
>>> them
>> This could be a solution, but for production I may change 
>> "org.exolab.castor.indent" which will force unittest relying on the string 
>> representation to fail...
>>
>> bye
>> Thomas
>>
>> ________________________________________
>> Von: Ralf Joachim [[email protected]]
>> Gesendet: Donnerstag, 30. Juni 2011 15:10
>> Bis: [email protected]
>> Betreff: Re: [castor-user] XML - how to generate toString() ?
>>
>> Hi Thomas,
>>
>> to my knowledge this isn't possible. But i asked myself why you do not
>> simply marshal them when you need a string representation of them.
>>
>> Regards
>> Ralf
>>
>> Am 30.06.2011 14:58, schrieb Papendieck, Thomas:
>>> Hello,
>>>
>>> is there a possibility to have castor genetating "toString()" methods using 
>>> the classes base name and all fields in the class?
>>>
>>> the output should be like this:
>>> ClassBaseName:[field1=field.toString(),field2isArray=[arrayElement1.toString(),arrayElement2.toString(),..],..]
>>>
>>> bye
>>> Thomas
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> --
>>
>> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
>> Ralf Joachim
>> Raiffeisenstraße 11
>> 72127 Kusterdingen
>> Germany
>>
>> Tel.   +49 7071 3690 52
>> Mobil: +49 173 9630135
>> Fax    +49 7071 3690 98
>>
>> Internet: www.syscon.eu
>> E-Mail: [email protected]
>>
>> Sitz der Gesellschaft: D-72127 Kusterdingen
>> Registereintrag: Amtsgericht Stuttgart, HRB 382295
>> Geschäftsleitung: Jens Joachim, Ralf Joachim
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
> 
> 
> --
> 
> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
> Ralf Joachim
> Raiffeisenstraße 11
> 72127 Kusterdingen
> Germany
> 
> Tel.   +49 7071 3690 52
> Mobil: +49 173 9630135
> Fax    +49 7071 3690 98
> 
> Internet: www.syscon.eu
> E-Mail: [email protected]
> 
> Sitz der Gesellschaft: D-72127 Kusterdingen
> Registereintrag: Amtsgericht Stuttgart, HRB 382295
> Geschäftsleitung: Jens Joachim, Ralf Joachim
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to