1
我有pojo class
变量的返回类型为JAXBElement<String>
。我想将它存储在java string.Could
中。 有人可以解释如何做到这一点?将JAXBElement <String>值转换为java字符串
File file = new File("C:/Users/Admin/Desktop/JubulaXMLFiles/DemoWithDrools_1.0.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Content.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
Content e=(Content) jaxbUnmarshaller.unmarshal(file);
String retrivedValue = (String)e.getProject().getName().toString();
System.out.println(retrivedValue);
输出就像[email protected]
。但我想检索retrivedValue
中的字符串的值。