public InputSource resolveEntity()

in doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java [677:711]


        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            byte[] res = ENTITY_CACHE.get(systemId);
            // already cached?
            if (res == null) {
                if (WELL_KNOWN_SYSTEM_IDS.containsKey(systemId)) {
                    String resource = "/" + WELL_KNOWN_SYSTEM_IDS.get(systemId);
                    URL url = getClass().getResource(resource);
                    if (url != null) {
                        LOGGER.debug(
                                "Resolving SYSTEM '{}' from well-known classpath resource '{}'", systemId, resource);
                        res = toByteArray(url);
                    }
                }

                if (res == null) {
                    URI uri = URI.create(systemId);
                    if (uri.getScheme() == null) {
                        uri = Paths.get(systemId).toUri();
                    }

                    LOGGER.debug("Resolving SYSTEM '{}' from URI resource '{}'", systemId, uri);
                    res = toByteArray(uri.toURL());
                }

                ENTITY_CACHE.put(systemId, res);
            } else {
                LOGGER.debug("Resolved SYSTEM '{}' from cache", systemId);
            }

            InputSource is = new InputSource(new ByteArrayInputStream(res));
            is.setPublicId(publicId);
            is.setSystemId(systemId);

            return is;
        }