Hi Thomas,

thomas fuller wrote:

> Hi,
> 
> I am trying to unmarshall XML that looks as follows:
> 
> <release_dates realtime_start="2012-01-01" realtime_end="9999-12-31"
> order_by="release_date" sort_order="desc" count="778" offset="0"
> limit="1000">
>     <release_date release_id="183"
>     release_name="BlahBlahBlah">*2012-06-18*
> </release_date>
>     <release_date release_id="184"
> release_name="BlahBlahBlah">2012-06-18</release_date>
>     <release_date release_id="185"
> release_name="BlahBlahBlah">2012-06-18</release_date>
>     ...
> <release_dates>
> 
> and at the moment I'm having some trouble setting the date, 2012-06-18, on
> the object, from the XML below:
> 
> <release_date release_id="183"
> release_name="BlahBlahBlah">2012-06-18</release_date>
> 
> My question is: can I do this with an annotation or am I right to use a
> converter?

Let's rephrase it: No, you cannot simply configure it, you have to register 
and use a specialized converter. Fortunately XStream already delivers a 
generalized one that can be used for this case: ToAttributedValueConverter. 
Registration is possible either by API or annotation.

> Using the below aliase will set all values on the ReleaseDate object aside
> from the date.
> 
> @XStreamAlias(RELEASE_DATE)
> 
> Thanks for your help.

Please read http://xstream.codehaus.org/faq.html#XML_unmarshalling_fails
and http://xstream.codehaus.org/faq.html#XML_double_underscores

- Jörg


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

    http://xircles.codehaus.org/manage_email


Reply via email to