Java XML Node to String dump(Node node)

Here you can find the source of dump(Node node)

Description

dump

License

Open Source License

Declaration

public static void dump(Node node) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileOutputStream;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Node;

public class Main {
    public static void dump(Node node) {
        try {/*from ww  w .j ava  2  s .c  o  m*/
            TransformerFactory fac = TransformerFactory.newInstance();
            Transformer t = fac.newTransformer();
            FileOutputStream fos = new FileOutputStream(new File("xsl.xsl"));
            t.transform(new DOMSource(node), new StreamResult(fos));
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related

  1. asXML(Node node)
  2. asXmlString(Node node)
  3. convertToString(Node node)
  4. convertToString(Node node)
  5. createXmlString(Node node)
  6. dumpNode(Node node)
  7. elementToString(Node element)
  8. getAttributeValue(Node node, String attrName)
  9. getDescriptionOfNode(Node node)