private static Document parseXmlFile(URI file, boolean validating) {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setValidating(validating);
            return factory.newDocumentBuilder().parse(file.toString());
        } catch (SAXException e) {
            logger.severe(e.getLocalizedMessage());
        } catch (ParserConfigurationException e) {
            logger.severe(e.getLocalizedMessage());
        } catch (IOException e) {
            logger.severe(e.getLocalizedMessage());
        }
        return null;
    }