Added these great answers to the WIKI:

http://www.brainopolis.com/castorwiki/Wiki.jsp?page=UserXMLFAQ



At 08:29 03/06/13 -0500, you wrote:


Karch, Bertram wrote:
      > how can I set/change the date format which is used for
      > java Date attributes
      > at marshalling an java object to XML ?
      >
      > I have the mapping
      >
      > <field name="actualTime" type="java.util.Date">
      >                 <bind-xml name="actualTime" node="element"/>
      > </field>
      >
      > and get
      > <actualTime>2003-06-12T17:18:46.984</actualTime>
      >
      > How can I set a different date format ?

Bertram, I asked this question a few days ago,
but it hasn't shown up on the archive yet.
Here is the answer Keith gave me:


I would probably opt for the GeneralizedFieldHandler myself and use auto-complete so that I could keep using introspection everywhere except for the specific date fields.

<class name="Foo" auto-complete="true">
   <field name="date" type="..." handler="MyCustomDateHandler"/>
</class>


I suppose another option is to write the XMLClassDescriptor and simply associate your date class with the descriptor in the ClassDescriptorResolver.

--Keith

"Ostermueller, Erik" wrote:
>
> Hello all,
>
> We need to marshal/unmarshal some proprietary date/time formats.
> Here are my options, as I see 'em:
>
> 1) pre-process the xml before passed to castor unmshalling,
> post-process after marshalling. Very slow. :-(
> 2) Add a SAX DocumentHandler (or is it ContentHandler?) to the chain.
> It would convert from proprietary format to schema format before unmarshal and
> vice-versa after the marshal.
> 3) Use the hot new GeneralizedFieldHandler.
> **** Is there a way to do this w/o using a mapping file? ****
> -- b/c we don't have the need for mapping file yet.
> 4) Create a new date/time handler (hack up the source).
>
> Have I missed anything?
> Any suggestions?
>
> Thanks,
>
> Erik
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev


-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to