@Override
    public InputSource resolveEntity(final String publicId, final String systemId) throws SAXException, IOException {
        if (!systemId.toLowerCase(Locale.getDefault()).startsWith("http://")) {
            final URL resource = getClass().getResource("flatpack.dtd");

            if (resource != null) {
                return new InputSource(resource.openStream());
            } else {
                // should probably not happen, this may indicate that the dtd has been
                // removed from the jar for some reason
                throw new IOException("could not load dtd resource from jar!!");
            }
        }

        // must be pulling from the web, stick with default implementation
        return null;
    }