Hi Craig,
Craig Burlock wrote:
> Hello all!
>
> Does anyone know how to remove the full package name of *ALL *classes and
> only leave the "simple name" (i.e. replace my.package.name.MyClass with
> MyClass)?
>
> I've tried xstream.alias("", "*"), but that doesn't work.
>
> (BTW, I may have the parameters around the wrong way - sorry if so)
>
> My XML contains many objects with many package names and I don't want to
> create an alias for each of them.
>
> Any ideas?
Apart from Joe's suggestion to alias every type individually,
there is also xstream.aliasPackage() or you may implement a CustomMapper
that overloads serializedClass and realClass. If you're interested in
writing XML only, you may simply drop the package name in the
serializedClass method and ignore realClass. XStream's acceptance test
CustomMapperTest has exactly such an implementation you can use.
Cheers,
Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email