users@jaxb.java.net

Re: White Space Elimination Problem

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 13 Jan 2003 07:11:57 -0800

> The "xs:token" does indeed sound much closer to what I'm looking
> for. However, the normalisation of strings in the middle is not
> good for me. Presumably there isn't a built-in type that just
> trims leading and trailing white space.
>
> Is it possible for me to define my own type that does this?

Looks like the answer is no.


> Is there some other way for me to cause some custom java code to
> be applied for particular types? Either during marshalling,
> unmarshalling or validation?

Yes, you can write your own methods and have them marshal/unmarshal text
in your XML. This would probably be useful for you.

The only thing to note is that since you cannot describe the constraint
in schema nicely, validation won't work to detect errors; your
conversion methods need to do it.

See the specification about <javaType parseMethod="..."
printMethod="..."/> for details of this feature.


regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com