我有一个pojo class
变量的返回类型是JAXBElement<String>
。我想将它存储在一个java string.Could
.
有人可以解释怎么做吗?
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);
输出就像javax.xml.bind.JAXBElement@5a99da
. 但我想检索.retrivedValue