Here you can find the source of createInputStream(Node node)
public static InputStream createInputStream(Node node) throws TransformerException
//package com.java2s; /*// w w w.ja v a 2s .c o m * Copyright (c) 2012. betterFORM Project - http://www.betterform.de * Licensed under the terms of BSD License */ import org.w3c.dom.Node; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; public class Main { public static InputStream createInputStream(Node node) throws TransformerException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); TransformerFactory.newInstance().newTransformer().transform(new DOMSource(node), new StreamResult(stream)); return new ByteArrayInputStream(stream.toByteArray()); } }