[Simple-support] How to serialize an object to this very simple XML (single inline element)?
Brought to you by:
niallg
|
From: Timo R. <tim...@di...> - 2013-04-23 16:32:27
|
Hello everyone, my goal is to serialize an object to this very simple XML: -------------------- <abc:response xmlns:abc="http://mynamespace.com/abc">true</abc:response> -------------------- I used this class: -------------------- @Root @Default @Namespace( prefix = "abc", reference = "http://mynamespace.com/abc" ) public static class Response { private Boolean success = true; // Property accessor here [...] } -------------------- With this serializer: -------------------- Format format = new Format( 0, null ); // 'null' to avoid the XML header Serializer serializer = new Persister( format ); -------------------- And I get this (wrong) result: -------------------- <abc:response xmlns:r2mds=" http://mynamespace.com/abc"> <success>true</success> </abc:response> -------------------- So the only difference (that matters) is, that the "true" is wrapped by the "<success>" element. Is it in any way possible to avoid the "<success>" element and put the "true" value inline, to get the desired result (see first example)? Thanks a lot for your help! Best Regards, Timo |