Phillippe,

What does the code that calls the unmarshaller look like? Make sure you
are not using one of the static unmarshal methods, otherwise in a static
method the Unmarshaller instance will be a new instance and not have
access to any mapping file you have set in an existing unmarshaller
instnace.

--Keith

philippe dandreis wrote:
> 
> Hi all,
> 
> I get a problem unmarshalling an xml stream. I want to handle an
> attribute within a FieldHandler and this FieldHandler is never called.
> 
> Here's the stack trace:
> 
> exception java.lang.IllegalArgumentException: Type conversion error:
> could not set value of eoclog(cnaf.framework.cnafdate.CnafDate) with
> value of type java.lang.String
> 
> java.lang.IllegalArgumentException: Type conversion error: could not
> set value of eoclog(cnaf.framework.cnafdate.CnafDate) with value of
> type java.lang.String
> 
> at
> 
> org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(FieldHandlerImpl.java:474)
> 
> at
> 
> org.exolab.castor.xml.UnmarshalHandler.processAttribute(UnmarshalHandler.java:2052)
> 
> at
> 
> org.exolab.castor.xml.UnmarshalHandler.processAttributes(UnmarshalHandler.java:1887)
> 
> at
> 
> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1567)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.java:245)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.java:182)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.processChildren(DOMEventProducer.java:333)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.java:247)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.process(DOMEventProducer.java:182)
> 
> at
> 
> org.exolab.castor.xml.util.DOMEventProducer.start(DOMEventProducer.java:110)
> 
> at
> 
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:507)
> 
> at
> 
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:591)
> 
> at
> 
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:661)
> 
> at DonneesXML.extractBean(DonneesXML.java:207)
> 
> at DonneesXML.traverse(DonneesXML.java:184)
> 
> at DonneesXML.getBeans(DonneesXML.java:113)
> 
> at Injection.main(Injection.java:20)
> 
> Here's the mapping file:
> 
> ...
> 
> <mapping>
> 
> <description>Description du mapping pour quiloy</description>
> 
> <class name="cnaf.cristal.majsituation.metier.liquidation.BgQuiloy">
> 
> <map-to xml="quiloy"/>
> 
> </class>
> 
> <class name="cnaf.cristal.majsituation.metier.liquidation.BgCritere1"
> auto-complete="true">
> 
> <field name="eoclog" type="string"
> 
> handler="cnaf.cristal.majsituation.metier.liquidation.HdlCnafDate">
> 
> <bind-xml name="eoclog" node="attribute"/>
> 
> </field>
> 
> </class>
> 
> </mapping>
> 
> ...
> 
> Here'is the XML file i want to unmarshall:
> 
> ...
> 
> <quiloy>
> 
> <critere1 eoclog="2003-10-10" coclgt="co" xoclgt="xo">
> 
> <critere1b coclgt="co" xoclgt="xo"/>
> 
> <critere1b coclgt="aa" xoclgt="bb"/>
> 
> <critere1b xoclgt="ee"/>
> 
> </critere1>
> 
> <critere2 dquily="2003-10-10" mlylgt="640" cptely="M" tpcloy="52.5"/>
> 
> </quiloy>
> 
> ...
> 
> 
> 
> In BgCritere1 class, the setter for the eoclog is:
> 
> public void setEoclog cnaf.framework.cnafdate.CnafDate value)
> 
> 
> 
> 
> 
> The HdlCnafDate extends AbstractFieldHandler and i also tried to
> extend GeneralizedFieldHandler but the result is the same: none of the
> handler's method is called.
> 
> Does anyone see what is wrong ?
> 
> Futhermore, what i would like to do is to handle all the "CnafDate"
> attributes of all my beans without having to declare a mapping file
> for each.
> 
> Any suggestion would be welcomed.
> 
> Philippe Dandreis.
> 
> ----------------------------------------------------------------------
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
> Testez le nouveau Yahoo! Mail

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

Reply via email to