public static Document readResourceDocument(Class<?> c, String name) {

        Document doc = null;

        InputStream is = null;
        try {

            is = c.getResourceAsStream(name);

            DocumentBuilder db = XMLUtils.newDocumentBuilder(false);
            doc = db.parse(is);

        } catch (SAXException e) {
            doc = null;
            e.printStackTrace();

        } catch (IOException e) {
            doc = null;
            e.printStackTrace();

        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException consumed) {

                }
            }
        }

        return doc;
    }