Okay, can you please create a new Jira issue at

http://jira.codehaus.org/browse/CASTOR

and attach source code, mapping file and XML documents. And please try
to keep things as minimal as possible.

Regards
Werner

Venkat Pavan Kumar Bellapu Konda wrote:
> Here is an example. Since the XML does not have created by and creation date
> elements. The Castor does not use the default handlers. If I added those
> elements to the XML then they are being used. Is there any way to default
> these values in the final object?
> Config file
> 
> <mapping>
> <description>AVQ Mapping Info</description>
>  <class name="com.comcast.ets.tpp.ilec.response.loader.entity.AVQResponse">
> <map-to xml="AVQ_RESPONSE" ns-uri="
> http://www.comcast.com/ets/tpp/ilec/inbound/avq/types"; />
> <field name="tppInAvqhdr"
> type="com.comcast.ets.tpp.ilec.response.loader.entity.avq.TppInAvqhdr">
> <bind-xml name="AVQHDR" node="element"/>
> </field>
> </class>
> 
> <class
> name="com.comcast.ets.tpp.ilec.response.loader.entity.avq.TppInAvqhdr">
> <map-to xml="AVQHDR" ns-uri="
> http://www.comcast.com/ets/tpp/ilec/inbound/avq/types"; />
> <field name="hdrRecType">
> <bind-xml name="HDR_REC_TYPE" node="element"/>
> </field>
> <field name="hdrType">
> <bind-xml name="HDR_TYPE" node="element"/>
> </field>
> <field name="hdrTxnum">
> <bind-xml name="HDR_TXNUM" node="element"/>
> </field>
> <field name="hdrTp">
> <bind-xml name="HDR_TP" node="element"/>
> </field>
> <field name="hdrDatetime">
> <bind-xml name="HDR_DATETIME" node="element"/>
> </field>
> * **<field name="createdBy" type="string"
> handler="com.comcast.ets.tpp.ilec.response.loader.utils.DefaultUserHandler"
> />*
> * **<field name="creationDate" type="string"
> handler="com.comcast.ets.tpp.ilec.response.loader.utils.SysdateHandler" />*
> </class>
> 
> Sample XML
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml version="1.0" encoding="utf-8"?>
>   <N1:AVQ_RESPONSE xmlns:N1="
> http://www.comcast.com/ets/tpp/ilec/inbound/avq/types";>
>     <N1:AVQHDR table="string">
>       <N1:HDR_REC_TYPE>3</N1:HDR_REC_TYPE>
>       <N1:HDR_TYPE>string</N1:HDR_TYPE>
>       <N1:HDR_TXNUM>string</N1:HDR_TXNUM>
>       <N1:HDR_TP>string</N1:HDR_TP>
>       <N1:HDR_DATETIME>string</N1:HDR_DATETIME>
>   </N1:AVQHDR>
> </N1:AVQ_RESPONSE>
> 
> On Wed, Sep 2, 2009 at 2:04 AM, Werner Guttmann <[email protected]>wrote:
> 
>> Actually, not sure myself. I definitely know how this is handled for
>> Java classes generated from XML schemas.
>>
>> As such, can I ask you to provide me with a minimal test case, and I
>> will have a look.
>>
>> Regards
>> Werner
>>
>> Venkat Pavan Kumar Bellapu Konda wrote:
>>> Hi,
>>>
>>> I have query regarding Castor XML mapping.
>>>
>>> I have a set of predefined java objects and I have an XML which I want to
>>> map to these java objects.
>>>
>>> I came up with the mapping file and everything works great apart from the
>>> custom field handlers. The field handlers only get invoked if there is a
>>> corresponding XML element. But what if I want to default a value if the
>> XML
>>> does not have an element?
>>>
>>> Please help me find a solution for this problem. I am sure you might have
>>> this feature, but I am not able to achieve this.
>>>
>>> Appreciate your help
>>>
>>> Thanks & Regards,
>>>
>>> Pavan
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
> 

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

    http://xircles.codehaus.org/manage_email


Reply via email to