当前位置: 首页>>代码示例>>Java>>正文


Java EntityResolver.resolveEntity方法代码示例

本文整理汇总了Java中org.xml.sax.EntityResolver.resolveEntity方法的典型用法代码示例。如果您正苦于以下问题:Java EntityResolver.resolveEntity方法的具体用法?Java EntityResolver.resolveEntity怎么用?Java EntityResolver.resolveEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.EntityResolver的用法示例。


在下文中一共展示了EntityResolver.resolveEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveEntity

import org.xml.sax.EntityResolver; //导入方法依赖的package包/类
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
	boolean trace = log.isTraceEnabled();

	for (Map.Entry<EntityResolver, String> entry : resolvers.entrySet()) {
		EntityResolver entityResolver = entry.getKey();
		if (trace)
			log.trace("Trying to resolve entity [" + publicId + "|" + systemId + "] through resolver "
					+ entry.getValue());
		InputSource entity = entityResolver.resolveEntity(publicId, systemId);

		String resolvedMsg = (entity != null ? "" : "not ");
		if (trace)
			log.trace("Entity [" + publicId + "|" + systemId + "] was " + resolvedMsg
					+ "resolved through entity resolver " + entry.getValue());

		if (entity != null) {
			return entity;
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:22,代码来源:ChainedEntityResolver.java

示例2: getModelSource

import org.xml.sax.EntityResolver; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:RuntimeCatalogModel.java

示例3: getInputSource

import org.xml.sax.EntityResolver; //导入方法依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ExternalEntity.java

示例4: makeInputSource

import org.xml.sax.EntityResolver; //导入方法依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SAXParseable.java


注:本文中的org.xml.sax.EntityResolver.resolveEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。