/** * Marshal this message to DOM. * @param message * @return DOM tree */ public static Element marshalObjectToDOM(Object message) { try { IBindingFactory jc = BindingDirectory.getFactory(message.getClass()); IMarshallingContext marshaller = jc.createMarshallingContext(); String[] namespaces = jc.getNamespaces(); JDOMWriter jdomWriter = new JDOMWriter(namespaces); marshaller.setXmlWriter(jdomWriter); marshaller.marshalDocument(message); marshaller.endDocument(); org.jdom.Document jdoc = jdomWriter.getDocument(); DOMOutputter dout = new DOMOutputter(); Document doc = dout.output(jdoc); Element node = doc.getDocumentElement(); return node; } catch (JiBXException e) { e.printStackTrace(); } catch (JDOMException e) { e.printStackTrace(); } return null; } /**
/** * Marshal this message to DOM. * @param message * @return DOM tree */ public static Element marshalObjectToDOM(Object message) { try { IBindingFactory jc = BindingDirectory.getFactory(message.getClass()); IMarshallingContext marshaller = jc.createMarshallingContext(); String[] namespaces = jc.getNamespaces(); JDOMWriter jdomWriter = new JDOMWriter(namespaces); marshaller.setXmlWriter(jdomWriter); marshaller.marshalDocument(message); marshaller.endDocument(); org.jdom.Document jdoc = jdomWriter.getDocument(); DOMOutputter dout = new DOMOutputter(); Document doc = dout.output(jdoc); Element node = doc.getDocumentElement(); return node; } catch (JiBXException e) { e.printStackTrace(); } catch (JDOMException e) { e.printStackTrace(); } return null; } /**