users@jaxb.java.net

Datatype conversion problem

From: Marcus Walls <marcus.walls_at_ASPECTIVE.COM>
Date: Fri, 06 Jun 2003 05:00:40 -0600

I have created my own datatype and customisation to support
the removal of leading and trailing whitespace from some of
my elements, because the built-in schema datatypes are not
sufficient - i.e. the token datatypes do this, but they also
affect the whitespace within the string which is not
acceptable.

This has been working for a while, but at a cost - I have to
switch off validation whilst unmarshalling. My schema
contains length validations, which I need to be applied to
the trimmed values - however the schema validation is applied
before my datatype conversion routines and thus I have to
switch it off.

Is this a necessary price for what I'm trying to achieve?
i.e. is there any way of performing the datatype conversions
before the validation occurs?

I was thinking of perhaps pre-processing the XML and doing
my trimming before passing it to JAXB, but alas the description
of which fields need to be trimmed is contained within the
schema and my pre-processing code wouldn't know which fields
to trim!

Anyone got any bright ideas?

Marcus