Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { public static DocumentBuilder getDocumentBuilder() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setIgnoringComments(true); DocumentBuilder db; try { db = factory.newDocumentBuilder(); return db; } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }