Java tutorial
//package com.java2s; import org.w3c.dom.*; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; public class Main { private static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); public static Document getXmlDocument(InputStream is) throws Exception { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return documentBuilder.parse(is); } }