我有一个pojo classwhere 变量的返回类型是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);
Run Code Online (Sandbox Code Playgroud)
输出就像javax.xml.bind.JAXBElement@5a99da. 但我想检索字符串的值retrivedValue。