我的程序JAVA:
public static String toXml() {
KtpMessage ktpMessage =new KtpMessage();
ktpMessage.setdetails("test");
XStream xstream = new XStream(new StaxDriver());
String objectXml = xstream.toXML(ktpMessage);
return objectXml;
结果是:
<?xml version='1.0' encoding='utf-8'?><myclasses.Message><details>test</details></myclasses.Message>
我的问题:我想生成“objectXml”但没有<?xml version='1.0' encoding='utf-8'?>
我该怎么做?
我想要这个结果:
<myclasses.Message><details>test</details></myclasses.Message>
感谢您的帮助