private static DocumentBuilder constructDocumentBuilder(List<SAXParseException> errors)
            throws ParserConfigurationException {

        DocumentBuilderFactory documentBuilderFactory = constructDocumentBuilderFactory();
        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new BindingXmlEntityResolver());
        docBuilder.setErrorHandler(new BindingXmlErrorHandler(errors));
        return docBuilder;
    }
private static DocumentBuilder constructDocumentBuilder ( List < SAXParseException > errors ) throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = constructDocumentBuilderFactory ( ) ; DocumentBuilder docBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; docBuilder . setEntityResolver ( new BindingXmlEntityResolver ( ) ) ; docBuilder . setErrorHandler ( new BindingXmlErrorHandler ( errors ) ) ; return docBuilder ; }
Helper used to construct a document builder
@param errors A list for holding any errors that take place
@return JAXP {@link DocumentBuilder}
@throws ParserConfigurationException If the parser cannot be initialised