@Override @Nullable public InputSource resolveEntity(String publicId, @Nullable String systemId) throws SAXException, IOException { if (systemId != null) { if (systemId.endsWith(DTD_SUFFIX)) { return this.dtdResolver.resolveEntity(publicId, systemId); } else if (systemId.endsWith(XSD_SUFFIX)) { return this.schemaResolver.resolveEntity(publicId, systemId); } } return null; }
@Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (delegate != null) { return delegate.resolveEntity(publicId, systemId); } else { return null; } }
/** * Filter an external entity resolution. * * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier. * @return A new InputSource or null for the default. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @exception java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. */ public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { if (entityResolver != null) { return entityResolver.resolveEntity(publicId, systemId); } else { return null; } }
@Override @Nullable public InputSource resolveEntity(String publicId, @Nullable String systemId) throws SAXException, IOException { if (systemId != null) { if (systemId.endsWith(DTD_SUFFIX)) { return this.dtdResolver.resolveEntity(publicId, systemId); } else if (systemId.endsWith(XSD_SUFFIX)) { return this.schemaResolver.resolveEntity(publicId, systemId); } } return null; }
/** * Filter an external entity resolution. * * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier. * @return A new InputSource or null for the default. * * @throws IOException * @throws SAXException The client may throw * an exception during processing. * @throws java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (m_entityResolver != null) { return m_entityResolver.resolveEntity(publicId, systemId); } else { return null; } }
/** * Filter an external entity resolution. * * @param publicId The entity's public identifier, or null. * @param systemId The entity's system identifier. * @return A new InputSource or null for the default. * * @throws IOException * @throws SAXException The client may throw * an exception during processing. * @throws java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (m_entityResolver != null) { return m_entityResolver.resolveEntity(publicId, systemId); } else { return null; } }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (entityResolver != null) { return this.entityResolver.resolveEntity(publicId, systemId); } else { return super.resolveEntity(publicId, systemId); } } }
@Override public LSInput resolveResource( String type, String namespaceURI, String publicId, String systemId, String baseURI) { // give the entity resolver an opportunity (mostly to throw an exception) try { InputSource is = entityResolver.resolveEntity(publicId, systemId); if (is != null) { return new InputSourceToLSResource(is); } } catch (SAXException | IOException e) { throw new RuntimeException(e); } // otherwise fall back on the default resolution path return delegate.resolveResource(type, namespaceURI, publicId, systemId, baseURI); } }
InputSource inputSource = entityResolver.resolveEntity( publicId, systemId); if (inputSource == null) {
/** * Test {@link PivotalEntityResolver#resolveEntity(String, String)} with <code>null</code> * <code>systemId</code>. Asserts that returns to <code>null<code>. * * @since GemFire 8.1 */ @Test public void testResolveEntityNullSystemId() throws SAXException, Exception { final String systemId = null; final InputSource inputSource = getEntityResolver().resolveEntity(null, systemId); assertNull(inputSource); }
/** * Test {@link PivotalEntityResolver#resolveEntity(String, String)} with * <code>"--not-a-valid-system-id--"</code> <code>systemId</code>, which is not in the Pivotal * namespace.. Asserts that returns to <code>null<code>. * * @since GemFire 8.1 */ @Test public void testResolveEntityUnkownSystemId() throws Exception { final String systemId = "--not-a-valid-system-id--"; final InputSource inputSource = getEntityResolver().resolveEntity(null, systemId); assertNull(inputSource); }
/** * Test {@link PivotalEntityResolver#resolveEntity(String, String)} with * <code>"http://schema.pivotal.io/this/should/be/not/found.xsd"</code> <code>systemId</code>, * which should not be found. Asserts that returns to <code>null<code>. * * @since GemFire 8.1 */ @Test public void testResolveEntityNotFoundSystemId() throws Exception { final String systemId = "http://schema.pivotal.io/this/should/be/not/found.xsd"; final InputSource inputSource = getEntityResolver().resolveEntity(null, systemId); assertNull(inputSource); }
/** * Resolve the cache.xml XSD using the {@link PivotalEntityResolver}. Verifies that the * META-INF/schemas files are correctly found. * * @since GemFire 8.1 */ @Test public void testResolveEntity() throws Exception { final InputSource inputSource = getEntityResolver().resolveEntity(null, getSystemId()); assertNotNull(inputSource); assertEquals(getSystemId(), inputSource.getSystemId()); }
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (systemId != null) { if (systemId.endsWith(DTD_SUFFIX)) { return this.dtdResolver.resolveEntity(publicId, systemId); } else if (systemId.endsWith(XSD_SUFFIX)) { return this.schemaResolver.resolveEntity(publicId, systemId); } } return null; }
protected boolean canResolveEntity(String publicId, String systemId) throws SAXException, IOException { final InputSource resolvedEntity = muleEntityResolver.resolveEntity(publicId, systemId); try { return resolvedEntity != null; } finally { if (resolvedEntity != null) { if (resolvedEntity.getByteStream() != null) { resolvedEntity.getByteStream().close(); } if (resolvedEntity.getCharacterStream() != null) { resolvedEntity.getCharacterStream().close(); } } } }
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { if (entityResolver!=null) { return entityResolver.resolveEntity(publicId, systemId); } return super.resolveEntity(publicId, systemId); }
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { log.trace("Trying to locate XML entity {} as configuration points schema.", systemId); Schema schema = schemas.findSchema(systemId); if (schema == null) { if (defaultEntityResolver != null) { return defaultEntityResolver.resolveEntity(publicId, systemId); } else { return null; } } log.debug("Found XML schema for systemId {}: {}", systemId, schema); InputSource inputSource = new InputSource(schema.getInputStream()); inputSource.setPublicId(publicId); inputSource.setSystemId(systemId); return inputSource; } }
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { log.trace("Trying to locate XML entity {} as configuration points schema.", systemId); Schema schema = schemas.findSchema(systemId); if (schema == null) { if (defaultEntityResolver != null) { return defaultEntityResolver.resolveEntity(publicId, systemId); } else { return null; } } log.debug("Found XML schema for systemId {}: {}", systemId, schema); InputSource inputSource = new InputSource(schema.getInputStream()); inputSource.setPublicId(publicId); inputSource.setSystemId(systemId); return inputSource; } }
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { log.trace("Trying to locate XML entity {} as configuration points schema.", systemId); Schema schema = schemas.findSchema(systemId); if (schema == null) { if (defaultEntityResolver != null) { return defaultEntityResolver.resolveEntity(publicId, systemId); } else { return null; } } log.debug("Found XML schema for systemId {}: {}", systemId, schema); InputSource inputSource = new InputSource(schema.getInputStream()); inputSource.setPublicId(publicId); inputSource.setSystemId(systemId); return inputSource; } }
protected void entityResolver(Document document) throws SAXException { if (entityResolver != null) { DocumentType docType = document.getDocType(); if (docType != null) { String publicID = docType.getPublicID(); String systemID = docType.getSystemID(); if ((publicID != null) || (systemID != null)) { try { entityResolver.resolveEntity(publicID, systemID); } catch (IOException e) { throw new SAXException("Could not resolve publicID: " + publicID + " systemID: " + systemID, e); } } } } }