I am trying to write a custom marshaller/unmarshaller for
java.util.Date class. My objective is to separate the date and time
parts of java.util.Date in the XML output as follows:

<person>
  <name>John</name>
  <birth-date>
     <date>2003-10-22</date>
     <time>07:00:28.961</time>
  </birth-date>
</person>

The java object is:

public class Person
{
   private String name;
   private java.util.Date aDate;
}

The binding.xml looks like this:

<binding>
  <mapping class="java.util.Date" name="birth-date"
      marshaller="DateSerializer" unmarshaller="DateSerializer"/>
  <mapping name="person" class="Person">
    <value name="name" field="name"/>
    <value name="birth-date" field="aDate"/>
  </mapping>
</binding>

When I run the code (I unmarshall first and then marshall it back), I get
a JiBXException "expected 'birth-date' end tag, found 'date' start
tag". This happens irrespective of whatever code I have in the
unmarshalling method of the DateSerializer class. When I run just the
marshall code, I get the w3c formatted date time string. It looks like the
custom marshaller and unmarshaller for date are not recognized.

Is it possible in JiBX to override the default behavior of a predefined
default format such as java.util.Date (other than overriding the
serializeDate/deserialize)? If so, what am I missing in the
above code? Any help is appreciated.

Thanks,
Vinay.



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to