org.xml.sax.EntityResolver#resolveEntity ( )源码实例Demo

下面列出了org.xml.sax.EntityResolver#resolveEntity ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码2 项目: TencentKona-8   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码3 项目: jdk8u60   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码4 项目: jdk8u60   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码5 项目: rice   文件: CompoundEntityResolver.java
/**
 * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
 */
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
    LOG.debug("resolveEntity: " + publicId + " " + systemId);
    for (EntityResolver resolver: resolvers) {
        LOG.debug("Invoking entity resolver: " + resolver);
        InputSource source = resolver.resolveEntity(publicId, systemId);
        if (source != null) {
            LOG.debug("source != null: " + source);
            return source;
        }
    }
    return null;
}
 
源代码6 项目: openjdk-jdk8u   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码7 项目: netbeans   文件: RuntimeCatalogModel.java
public ModelSource getModelSource(URI locationURI,
        ModelSource modelSourceOfSourceDocument) throws CatalogModelException {
    InputStream inputStream = null;
    try {
        UserCatalog cat = UserCatalog.getDefault();
        // mainly for unit tests
        if (cat == null) {
            return null;
        }
        EntityResolver resolver = cat.getEntityResolver();
        InputSource src = resolver.resolveEntity(null, locationURI.toString());
        if(src != null) {
            inputStream = new URL(src.getSystemId()).openStream();
        } else {
            javax.xml.transform.Source isrc = ((javax.xml.transform.URIResolver)resolver).
                    resolve(locationURI.toString(), null);
            if(isrc != null)
                inputStream = new URL(isrc.getSystemId()).openStream();
        }
        if(inputStream != null)
            return createModelSource(inputStream);
    } catch (Exception ex) {
        throw new CatalogModelException(ex);
    }
    
    return null;
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码10 项目: openjdk-jdk9   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码11 项目: openjdk-jdk9   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码12 项目: hottub   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码13 项目: hottub   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码14 项目: openjdk-8-source   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码15 项目: openjdk-8-source   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码16 项目: openjdk-8   文件: ExternalEntity.java
public InputSource getInputSource(EntityResolver r)
        throws IOException, SAXException {

    InputSource retval;

    retval = r.resolveEntity(publicId, systemId);
    // SAX sez if null is returned, use the URI directly
    if (retval == null)
        retval = Resolver.createInputSource(new URL(systemId), false);
    return retval;
}
 
源代码17 项目: openjdk-8   文件: SAXParseable.java
private static InputSource makeInputSource(XMLReader xr, String systemId) throws IOException, SAXException {
  EntityResolver er = xr.getEntityResolver();
  if (er != null) {
    InputSource inputSource = er.resolveEntity(null, systemId);
    if (inputSource != null)
  return inputSource;
  }
  return new InputSource(systemId);
}
 
源代码18 项目: jolie   文件: NGCCRuntimeEx.java
/**
 * Resolves relative URI found in the document.
 *
 * @param namespaceURI
 *      passed to the entity resolver.
 * @param relativeUri
 *      value of the schemaLocation attribute. Can be null.
 *
 * @return
 *      non-null if {@link EntityResolver} returned an {@link InputSource},
 *      or if the relativeUri parameter seems to be pointing to something.
 *      Otherwise it returns null, in which case import/include should be abandoned.
 */
private InputSource resolveRelativeURL( String namespaceURI, String relativeUri ) throws SAXException {
    try {
        String baseUri = getLocator().getSystemId();
        if(baseUri==null)
            // if the base URI is not available, the document system ID is
            // better than nothing.
            baseUri=documentSystemId;

        String systemId = null;
        if(relativeUri!=null)
            systemId = Uri.resolve(baseUri,relativeUri);

        EntityResolver er = parser.getEntityResolver();
        if(er!=null) {
            InputSource is = er.resolveEntity(namespaceURI,systemId);
            if(is!=null)
                return is;
        }

        if(systemId!=null)
            return new InputSource(systemId);
        else
            return null;
    } catch (IOException e) {
        SAXParseException se = new SAXParseException(e.getMessage(),getLocator(),e);
        parser.errorHandler.error(se);
        return null;
    }
}
 
源代码19 项目: ph-commons   文件: MicroSAXHandler.java
@Nullable
public InputSource resolveEntity (final String sPublicId, final String sSystemId) throws IOException, SAXException
{
  _updatePosition ("resolveEntity");
  final EntityResolver aER = m_aEntityResolver;
  if (aER != null)
    return aER.resolveEntity (sPublicId, sSystemId);

  // If using XHTML this should be replaced by using the LocalEntityResolver
  // instead
  if (sPublicId == null)
  {
    if (LOGGER.isInfoEnabled ())
      LOGGER.info ("Need to resolve entity with system ID '" + sSystemId + "'");
  }
  else
    if (sSystemId == null)
    {
      if (LOGGER.isInfoEnabled ())
        LOGGER.info ("Need to resolve entity with public ID '" + sPublicId + "'");
    }
    else
    {
      if (LOGGER.isInfoEnabled ())
        LOGGER.info ("Need to resolve entity with public ID '" + sPublicId + "' and system ID '" + sSystemId + "'");
    }
  return null;
}
 
源代码20 项目: ph-commons   文件: MicroSAXHandler.java
@Nullable
public InputSource resolveEntity (@Nullable final String sName,
                                  @Nullable final String sPublicId,
                                  @Nullable final String sBaseURI,
                                  @Nonnull final String sSystemId) throws SAXException, IOException
{
  _updatePosition ("resolveEntity2");
  final EntityResolver2 aER2 = m_aEntityResolver2;
  if (aER2 != null)
    return aER2.resolveEntity (sName, sPublicId, sBaseURI, sSystemId);

  final EntityResolver aER = m_aEntityResolver;
  if (aER != null)
    return aER.resolveEntity (sPublicId, sSystemId);

  if (LOGGER.isInfoEnabled ())
    LOGGER.info ("Need to resolve entity with name '" +
                 sName +
                 "', public ID '" +
                 sPublicId +
                 "' base URI '" +
                 sBaseURI +
                 "' and system ID '" +
                 sSystemId +
                 "'");
  return null;
}
 
 方法所在类
 同类方法