當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。