我需要通过请求获取 Element 对象。我有对象工厂。我创建了一个 JAXBElement,我需要将它编码到 Element。谁能帮帮我?
最佳答案
您可以编码为 DOMResult
:
DOMResult res = new DOMResult();
marshaller.marshal(myJaxbElement, res);
Element elt = ((Document)res.getNode()).getDocumentElement();
关于java - 如何使用 JAXB 将 JAXBElement<Object> 编码到 Java 中的 org.w3c.dom.Element,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13569572/