Quintin Par Quintin Par - 3 months ago 20
Java Question

Xstream: removing class attribute

How do I remove the class=”Something ” attributes in Xstream .

I use Xstream with annotations

Answer

Indeed the problem is not as clearly phrased as it should. My guess is that you are using a non-standard collection or using a field of an interface type for which XStream needs to store the actual class.

In the second case you can just use alias:

xstream.alias("field name", Interface.class, ActualClassToUse.class);

See http://markmail.org/message/gds63p3dnhpy3ef2 for more details.

Comments