Here you can find the source of copyTreeToResult(Node tree, Result result)
Parameter | Description |
---|---|
tree | a parameter |
node | a parameter |
public static boolean copyTreeToResult(Node tree, Result result)
//package com.java2s; import javax.xml.transform.Result; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import org.w3c.dom.Node; public class Main { /**//from w w w. ja v a 2 s .c om * Copy DOM tree to a SOAP tree. * @param tree * @param node * @return The parent of the new child node. */ public static boolean copyTreeToResult(Node tree, Result result) { try { // Use a Transformer for output TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); DOMSource source = new DOMSource(tree); transformer.transform(source, result); return true; // Success } catch (TransformerConfigurationException tce) { // Error generated by the parser tce.printStackTrace(); } catch (TransformerException te) { // Error generated by the parser te.printStackTrace(); } return false; // Failure } }