Keith, thanks for your response; it helps me to find the problem:
I called the unmarshal method with two arguments:
o = u.unmarshal(BgQuiloy.class, node);
I modified this line to:
o = u.unmarshal(node);
I works fine: my FieldHandler is now called. It seems that giving the class type to the unmarshaller makes it ignore the mapping.
I have now to solve the second part of the problem which is to process every argument of this specific type with my FieldHandler without to have to declare a mapping file for each of my beans.
Thanks for your suggestion(s).
Keith Visco <[EMAIL PROTECTED]> wrote:
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:
>
> ...
>
>
>
>Description du mapping pour quiloy
>
>
>
>
>
>
>
>> auto-complete="true">
>
>>
> handler="cnaf.cristal.majsituation.metier.liquidation.HdlCnafDate">
>
>
>
>
>
>
>
>
>
> ...
>
> Here'is the XML file i want to unmarshall:
>
> ...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ...
>
>
>
> 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 gratuitte 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
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Testez le nouveau Yahoo! Mail
