Some old XML still has the canonical class name. The new XML has the simple name.
I want to be able to read both formats but make sure that when I marshal I get the simple names. I have tried using...
xstream.alias("package.name.className", Clazz.class);
xstream.alias("className", Clazz.class);
the unmarshalling works fine but the marshalling is mixed. For some classes I get the simple name, others the canonical.
Any idea how to achieve this with the same xstream instance?
The beautiful way would be writing a custom Converter for your class.
The other way is have one xstream instance for unmarshalling with both alias and another xstream instance for marshalling only with the alias you want.