Hi,

as far as I know, you could provide a custom binding file to the XML source code generator, and define a FieldHandler to be used for this one property.

Does this make sense ?

Cheers
Werner

On 06.03.2010 19:19, [email protected] wrote:

Hi,
I am using castor 1.3.
How can I configure a FieldHandler for a single nested element in my xml file.
I already have a bunch of descriptor classes for my xml file. These were 
generated from
an xml schema.
However one of the nested elements is a date field which sometimes has a value 
that cannot be
handled by Castor. It contains a single digit for day or for month. See below 
example.
Therefore I created a mapping file for the element containing the field and 
configured it to use
a FieldHandler.
Strongly simplified the xml looks like:
<root>

  <inner1>
    <field1>
      ...
    </field1>
    <datefield>
   2010-03-1T09:57:01+01:00
    </datefield>
    ...
  </inner1>

  <inner2>
    <field1>
    </field1>
    ...
  </inner2>
<root>
and the mapping looks like:
<mapping>
   <class name="nl.foo.Inner1">
     <field name="datefield" type="string" handler="MyDateHandler">
       <bind-xml name="inner1" node="element" />
     </field>
   </class>
</mapping>
The thing is: This works in an container environment (application running in 
OC4J application server on windows).
However when I run the same code outside the container it does not work; 
Handler is not called.
Also it does not work under a different application server (Oracle AS/Linux)
Question:
Am I using the right solution? Or should I make a mapping for the entire xml. 
But that would mean making
a complex mapping while I only want a fieldhandler for a single field. I 
already have the descriptors.
Greetings,
Huub


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

   http://xircles.codehaus.org/manage_email


Reply via email to