I inherited a project that was built using XStream 1.2.2. It will be
possible upgrade to 1.4.4, but there is no testing around XStream, so I
would need to do a lot of manual testing.

Trying to come up with a more automatic way of creating output. The XML is
normalized in standard XML fields. For example:
String foo = "bar";

results in

<field name="foo">bar</field>

Although I would like an automatic way to have this format for all
attributes way, I was not able to find an easy solution. I then looked at
annotating classes in order to use a custom converter:

@XStreamConverter(MyFieldConverter.class)
String foo;

However, it seems I cannot access the variable name "foo". I can see the
value in the writer's element stack, but the stack is not publicly
accessible. Is there a way to retrieve the field name?

Another option I can see is to post-process the XML using XSLT. Is it
possible to associate an XSLT with a class?

If my code has:
xstream.marshal(obj, new CompactWriter(out));
can I associate an XSLT with obj's class? If not, do I setup the
traxsource/transformer as shown in the example before my marshal call?

Cheers,

Ivan

Reply via email to