customising serialisation of java collections using xstream
- by Will Goring
I have an object that needs to be serialised as XML, which contains the following field:
List<String> tags = new List<String>();
XStream serialises it just fine (after some aliases) like this:
<tags>
<string>tagOne</string>
<string>tagTwo</string>
<string>tagThree</string>
<string>tagFour</string>
</tags>
That's OK as far as it goes, but I'd like to be able to rename the <string> elements to, say, <tag>. I can't see an obvious way to do that from the alias documentation on the XStream site. Am I missing something obvious?