jaxb - XStreamAsAttribute not adding as attribute - xstream -
i wrote class converted xstream xml .
i added @xstreamasattribute add xmlns attribute . got added nested tag in output
my class file follows
@xstreamalias("getconfigurationparametersresponse") public class getconfigurationparametersresponse extends baseresponse { @xstreamalias("xmlns") @xstreamasattribute final string xmlns = "http://www.collab.net/teamforge/integratedapp"; @xstreamalias("xmlns:ns2") @xstreamasattribute final string ns2="http://www.collab.net/teamforge/integratedapp"; @xstreamimplicit(itemfieldname="configurationparameter") protected list<configurationparameter> configurationparameter; public list<configurationparameter> getconfigurationparameter() { if (configurationparameter == null) { configurationparameter = new arraylist<configurationparameter>(); } return this.configurationparameter; } }
the output follows
<com.collabnet.teamforge.ia.getconfigurationparametersresponse> <xmlns>http://www.collab.net/teamforge/integratedapp</xmlns> <ns2>http://www.collab.net/teamforge/integratedapp</ns2> </com.collabnet.teamforge.ia.getconfigurationparametersresponse>
but need output
<com.collabnet.teamforge.ia.getconfigurationparametersresponse xmlns="http://www.collab.net/teamforge/integratedapp" xmlns:ns2="http://www.collab.net/teamforge/integratedapp"> </com.collabnet.teamforge.ia.getconfigurationparametersresponse>
please in finding out going wrong . followed tutorial http://x-stream.github.io/annotations-tutorial.html
you need following:
xstream.processannotations(getconfigurationparametersresponse.class);
if following being called:
xstream.processannotations(baseresponse.class);
then use @xstreaminclude
annotation on baseresponse
follows:
@xstreaminclude({getconfigurationparametersresponse.class}) public class baseresponse { }
Comments
Post a Comment