I'm using JiBX to bind xml data stream messages to java objects... but the
data stream messages are not always valid.

For example, one element has an attribute countryId that is an int but
sometimes the messages are coming through as countryId="" (empty string).
JiBX throws an exception for "empty number value".

How do I tell JiBX to ignore this error and/or just use some default value?
And is there a concrete example somewhere I can look at?

I think one solution is write a custom deserializer for this but I'm having
problems getting that to work. In my binding I have:

<value name="countryid" field="homeCountryId" deserializer="
WsbUtil.deserializeId" />

And in WsbUtil I have:

public static int deserializeId(String idString) {
    if (idString == null) {
        return -1;
    } else {
        return Integer.parseInt(idString);
    }
}

But I'm getting Error: Static deserializer method WsbUtil.deserializeId not
found even though it should be in the classpath and have the right
signature.

Any help would be appreciated.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to