Hi Keith

I finally got the chance to try what you tell me and it worked (although a little different):

For an entry of type xs:int the GeneralizedFieldHandler.getFieldType () I return Integer.class For an entry of type xs:string the GeneralizedFieldHandler.getFieldType() I return String.class

Before I was returning the type of my object (MonthYear.class), now by returning the same type as declared in the schema it actually works and I am just getting : <expirationDate xmlns="">200512</ expirationDate>

Thanks a lot
Yan

On Nov 8, 2005, at 8:41 PM, Keith Visco wrote:

Yan,

Try returning a String from your GeneralizedFieldHandler and see if it makes a difference.

--Keith

Yan Pujante wrote:
Hello
I am trying to do the following. I have an xml schema containing the following
section:
      <xs:element name="expirationDate" type="xs:int"/>
I then have a binding file which declares the following:
    <cbf:elementBinding name="expirationDate">
      <cbf:member java-type="test.castor.MonthYear"
                  handler="test.castor.MonthYearFieldHandler"/>
    </cbf:elementBinding>
MonthYear is a simple class that converts a number 200510 into a year and a month.
My field handler inherits from GeneralizedFieldHandler.
I run the code generator on it and when I run my program to marshall my object,
the following xml gets rendered:
<expirationDate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:type="java:java.lang.Integer">200512</ expirationDate>
What I would really want is
<expirationDate>200512</expirationDate>
Why does it get generated like this ? Is there a way to change this behavior ? I know that in the example given in the documentation the xml looks like this:
<root>2004-05-10</root>
Why does it look different for me ? (the only thing different is that I am using a
binding file and code generation rather than a mapping file.
Thanks for your help
Yan Pujante


-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to