Hi,
Is there a way to customize XML serialization in JAXB, in the same way that it's possible using IXmlSerializable in .NET? (i.e. the ability to directly control serialization of an object using the equivalent of an XmlReader/Writer).
I've taken a look at XmlAdapter and @XmlJavaTypeAdapter, but they just seem to be used to transform types to and from serializable forms, which isn't quite what I want.
Update: In particular, I'd like to customize the deserialization of a root object, that determines, programatically, exactly how to deserialize the inner XML (e.g. create a jaxb unmarshaller with a particular set of known types).
Update: I've found a way to solve the problem, but it's such a nasty hack I'll probably go with one of the solutions suggested by the other posters.