Java examples for XML:DOM Document
get XML Document From Stream
//package com.java2s; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { public static Document getDocumentFromStream(InputStream is, boolean namespaceAware) { try {//from w ww .ja va 2s . c om DocumentBuilderFactory dbf = DocumentBuilderFactory .newInstance(); dbf.setNamespaceAware(namespaceAware); DocumentBuilder builder = dbf.newDocumentBuilder(); Document ret = builder.parse(is); return ret; } catch (Exception e) { throw new RuntimeException(e); } } }