u...">

How to prevent XStream from displaying class = "string"?

Is there a way to prevent XStream from displaying as follows:

<user class="string">user</user>
<password class="string">password</password>

in xml output?

0
source share
1 answer

Missing fields

For proper deserialization, XStream must write the complete graph of the object in XML, referenced by one object. Therefore, XStream has to find a view that contains all aspects to recreate objects.

However, some parts may be redundant, for example. if the member field is lazy initialized and its contents can be easily recreated. In this case, the field can be omitted using XStream.omitField (class, string) .

@See: xStream documentation

+1
source

All Articles