Code example for DefaultHandler

        // with a SchemaUrl, a URL object 
        //factory.setAttribute("", ""); 
        //factory.setAttribute("", SchemaUrl); 
        DocumentBuilder builder = factory.newDocumentBuilder();
        if (validate) {
            LocalResolver lr = new LocalResolver(new DefaultHandler());
            ErrorHandler eh = new LocalErrorHandler(docDescription, lr);
        document = builder.parse(is);
        double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0;
        if (Debug.verboseOn()) Debug.logVerbose("XML Read " + totalSeconds + "s: " + docDescription, module);
        return document;
    public static Document readXmlDocument(InputStream is, boolean validate, String docDescription, boolean withPosition)
            throws SAXException, ParserConfigurationException, {
Connect your IDE to all the code out there  Get Codota for Java