-----Ursprüngliche Nachricht-----
Von: Ralf Joachim [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 30. Mai 2007 11:28
An: [email protected]
Betreff: Re: [castor-user] Re: Preserving Unmarshall Sequence
Hi Werner,
I think it is reasonable to expect Castor to marshal objects in a
collection/list in the sequence they are contained in the list and do
not reorder them in any way.
If this isn't possible yet, I think this should be added and be
configured to be the default behaviour at least for introspection and
when using mapping.
Regards
Ralf
Werner Guttmann schrieb:
> Within Castor, other than using multiple mapping files (with each of
> them specifying the required sequence of fields), no.
>
> And with regards to abandoning Castor, I know that e.g. JAXB allows
you
> to define one sequence only (by the means of a JAXB annotation), and
not
> multiple ones.
>
> If I were you, I'd consider using XSLT (whether manually or within a
> framework such as Cocoon) on top of Castor, to sort the original
output
> according to your specific needs. Castor's Marshaller supports
> marshalling to SAX events, which could be directly feed into e.g. a
> Cocoon pipeline or a JAXP transformer.
>
> Regards
> Werner
>
> [EMAIL PROTECTED] wrote:
>> The sequence could be different each time - the xml document
describes
a
>> gui , and the order in which the elements appear in the file
determines
>> the tab order in the legacy system, hence the requirement to
marshall
>> objects in a particular sequence.
>> So, in one file, the order may need to be label, button, field,
field,
>> but in another it could be field, button, field, button, and so on.
>> Is there any solution to this? Or do I need to abandon Castor -
which
>> would be a shame.
>>
>> Werner Guttmann writes:
>>> How about trying to match the sequence of your field mappings in
the
>>> mapping file to the expected sequence ? If you use a mapping file,
>>> Castor simply marshalls fields as encountered in the mapping file.
>>> Werner
>>> [EMAIL PROTECTED] wrote:
>>>> Can Castor preserve the sequence of elements it unmarshalls when
it
goes
>>>> to marshall things back up?
>>>> Example:
>>>> XML going in..
>>>> <window>
>>>> <button> Button1 </button>
>>>> <label> Label1 </label>
>>>> <button> Button2 </button>
>>>> </window>
>>>> XML going out
>>>> <window>
>>>> <button> Button1 </button>
>>>> <button> Button2 </button>
>>>> <label> Label1 </label>
>>>> </window>
>>>> When being marshalled back up, Castor will group all the buttons
>>>> together, labels, etc. in the order as defined by the mapping
file.
>>>> However, for reasons that are beyond my control, I need to be able
to
>>>> write out the XML file in the same order that I read it in. I
tried
>>>> putting all elements in a single vector, but I get an error
complaining
>>>> of multiple instances of the same field in the mapping file.
>>>> Any suggestions?
>>>> Thank you,
>>>> Justin
>>>>
---------------------------------------------------------------------
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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