Java tutorial
//package com.java2s; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { /** * Initializes {@link DocumentBuilder} from passed {@link InputStream} of * XML document's file * * @param stream * @return {@link DocumentBuilder} initialized from {@link InputStream} * @throws ParserConfigurationException */ private static DocumentBuilder initDocumentBuilder(InputStream stream) throws ParserConfigurationException { DocumentBuilder builder; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); builder = factory.newDocumentBuilder(); return builder; } }