當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityResolver2類代碼示例

本文整理匯總了Java中org.xml.sax.ext.EntityResolver2的典型用法代碼示例。如果您正苦於以下問題:Java EntityResolver2類的具體用法?Java EntityResolver2怎麽用?Java EntityResolver2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityResolver2類屬於org.xml.sax.ext包,在下文中一共展示了EntityResolver2類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newDigester

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Create a <code>Digester</code> parser.
 * @param xmlValidation turn on/off xml validation
 * @param xmlNamespaceAware turn on/off namespace validation
 * @param rule an instance of <code>RuleSet</code> used for parsing the xml.
 * @param blockExternal turn on/off the blocking of external resources
 */
public static Digester newDigester(boolean xmlValidation,
                                   boolean xmlNamespaceAware,
                                   RuleSet rule,
                                   boolean blockExternal) {
    Digester digester = new Digester();
    digester.setNamespaceAware(xmlNamespaceAware);
    digester.setValidating(xmlValidation);
    digester.setUseContextClassLoader(true);
    EntityResolver2 resolver = new LocalResolver(SERVLET_API_PUBLIC_IDS,
            SERVLET_API_SYSTEM_IDS, blockExternal);
    digester.setEntityResolver(resolver);
    if (rule != null) {
        digester.addRuleSet(rule);
    }

    return digester;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:25,代碼來源:DigesterFactory.java

示例2: newDigester

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Create a <code>Digester</code> parser.
 *
 * @param xmlValidation     turn on/off xml validation
 * @param xmlNamespaceAware turn on/off namespace validation
 * @param rule              an instance of <code>RuleSet</code> used for parsing the xml.
 * @param blockExternal     turn on/off the blocking of external resources
 */
public static Digester newDigester(boolean xmlValidation,
                                   boolean xmlNamespaceAware,
                                   RuleSet rule,
                                   boolean blockExternal) {
    Digester digester = new Digester();
    digester.setNamespaceAware(xmlNamespaceAware);
    digester.setValidating(xmlValidation);
    digester.setUseContextClassLoader(true);
    EntityResolver2 resolver = new LocalResolver(SERVLET_API_PUBLIC_IDS,
            SERVLET_API_SYSTEM_IDS, blockExternal);
    digester.setEntityResolver(resolver);
    if (rule != null) {
        digester.addRuleSet(rule);
    }

    return digester;
}
 
開發者ID:nkasvosve,項目名稱:beyondj,代碼行數:26,代碼來源:DigesterFactory.java

示例3: resolveEntity

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
@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);

  s_aLogger.info ("Need to resolve entity with name '" +
                  sName +
                  "', public ID '" +
                  sPublicId +
                  "' base URI '" +
                  sBaseURI +
                  "' and system ID '" +
                  sSystemId +
                  "'");
  return null;
}
 
開發者ID:phax,項目名稱:ph-commons,代碼行數:27,代碼來源:MicroSAXHandler.java

示例4: setEntityResolver

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Sets the resolver used to resolve external entities. The EntityResolver
 * interface supports resolution of public and system identifiers.
 *
 * @param resolver The new entity resolver. Passing a null value will
 *                 uninstall the currently installed resolver.
 */
public void setEntityResolver(EntityResolver resolver) {

    try {
        XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER);
        if (fUseEntityResolver2 && resolver instanceof EntityResolver2) {
            if (xer instanceof EntityResolver2Wrapper) {
                EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer;
                er2w.setEntityResolver((EntityResolver2) resolver);
            }
            else {
                fConfiguration.setProperty(ENTITY_RESOLVER,
                        new EntityResolver2Wrapper((EntityResolver2) resolver));
            }
        }
        else {
            if (xer instanceof EntityResolverWrapper) {
                EntityResolverWrapper erw = (EntityResolverWrapper) xer;
                erw.setEntityResolver(resolver);
            }
            else {
                fConfiguration.setProperty(ENTITY_RESOLVER,
                        new EntityResolverWrapper(resolver));
            }
        }
    }
    catch (XMLConfigurationException e) {
        // do nothing
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:38,代碼來源:AbstractSAXParser.java

示例5: resolveEntityByEntityResolvers

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Resolve entity using discovered {@link EntityResolver2}s.
 * 
 * @param publicId
 * @param systemId
 * @return {@link InputSource} for resolved entity if found, otherwise null.
 * @throws IOException
 * @throws SAXException
 * @since GemFire 8.1
 */
private InputSource resolveEntityByEntityResolvers(String name, String publicId, String baseURI,
    String systemId) throws SAXException, IOException {
  final ServiceLoader<EntityResolver2> entityResolvers =
      ServiceLoader.load(EntityResolver2.class, ClassPathLoader.getLatest().asClassLoader());
  for (final EntityResolver2 entityResolver : entityResolvers) {
    final InputSource inputSource =
        entityResolver.resolveEntity(name, publicId, baseURI, systemId);
    if (null != inputSource) {
      return inputSource;
    }
  }
  return null;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:24,代碼來源:CacheXml.java

示例6: testDiscovery

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Find the {@link PivotalEntityResolver} in the {@link ClassPathLoader}. Verifies that the
 * META-INF/services file is correctly found and the the implementation class is loadable.
 * 
 * @since GemFire 8.1
 */
@Test
public void testDiscovery() {
  boolean found = false;
  final ServiceLoader<EntityResolver2> entityResolvers =
      ServiceLoader.load(EntityResolver2.class, ClassPathLoader.getLatestAsClassLoader());
  for (final EntityResolver2 entityResolver : entityResolvers) {
    if (getEntityResolver().getClass().isAssignableFrom(entityResolver.getClass())) {
      found = true;
      break;
    }
  }
  assertTrue("Resolver not found.", found);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:20,代碼來源:AbstractEntityResolverTest.java

示例7: newDigester

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Create a <code>Digester</code> parser.
 * 
 * @param xmlValidation
 *            turn on/off xml validation
 * @param xmlNamespaceAware
 *            turn on/off namespace validation
 * @param rule
 *            an instance of <code>RuleSet</code> used for parsing the xml.
 * @param blockExternal
 *            turn on/off the blocking of external resources
 */
public static Digester newDigester(boolean xmlValidation, boolean xmlNamespaceAware, RuleSet rule,
		boolean blockExternal) {
	Digester digester = new Digester();
	digester.setNamespaceAware(xmlNamespaceAware);
	digester.setValidating(xmlValidation);
	digester.setUseContextClassLoader(true);
	EntityResolver2 resolver = new LocalResolver(SERVLET_API_PUBLIC_IDS, SERVLET_API_SYSTEM_IDS, blockExternal);
	digester.setEntityResolver(resolver);
	if (rule != null) {
		digester.addRuleSet(rule);
	}

	return digester;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:27,代碼來源:DigesterFactory.java

示例8: EntityResolverWrapper

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
private EntityResolverWrapper(EntityResolver entityResolver, boolean promiscuous) {
  this.entityResolver = entityResolver;
  if (entityResolver instanceof EntityResolver2)
    entityResolver2 = (EntityResolver2)entityResolver;
  else
    entityResolver2 = null;
  this.promiscuous = promiscuous;
}
 
開發者ID:relaxng,項目名稱:jing-trang,代碼行數:9,代碼來源:SAX.java

示例9: readMicroXML

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * Read the passed input source as MicroXML.
 *
 * @param aInputSource
 *        The input source to use. May be <code>null</code> in which case
 *        <code>null</code> is directly returned.
 * @param aSettings
 *        The settings to use. If <code>null</code> the default settings will
 *        be used.
 * @return <code>null</code> if either the input source is <code>null</code>
 *         or if the input was invalid XML.
 */
@Nullable
public static IMicroDocument readMicroXML (@WillClose @Nullable final InputSource aInputSource,
                                           @Nullable final ISAXReaderSettings aSettings)
{
  if (aInputSource == null)
    return null;

  final EntityResolver aEntityResolver = aSettings == null ? null : aSettings.getEntityResolver ();
  final MicroSAXHandler aMicroHandler = new MicroSAXHandler (false, aEntityResolver, true);

  // Copy and modify settings
  final SAXReaderSettings aRealSettings = SAXReaderSettings.createCloneOnDemand (aSettings);
  aRealSettings.setEntityResolver (aMicroHandler)
               .setDTDHandler (aMicroHandler)
               .setContentHandler (aMicroHandler)
               .setLexicalHandler (aMicroHandler);
  if (aRealSettings.getErrorHandler () == null)
  {
    // Use MicroHandler as default error handler if none is specified
    aRealSettings.setErrorHandler (aMicroHandler);
  }
  if (aEntityResolver instanceof EntityResolver2)
  {
    // Ensure to use the new aEntityResolver2 APIs if available
    aRealSettings.setFeatureValue (EXMLParserFeature.USE_ENTITY_RESOLVER2, true);
  }

  if (SAXReader.readXMLSAX (aInputSource, aRealSettings).isFailure ())
    return null;
  return aMicroHandler.getDocument ();
}
 
開發者ID:phax,項目名稱:ph-commons,代碼行數:44,代碼來源:MicroReader.java

示例10: MicroSAXHandler

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
public MicroSAXHandler (final boolean bSaveIgnorableWhitespaces,
                        @Nullable final EntityResolver aEntityResolver,
                        final boolean bTrackPosition)
{
  m_bSaveIgnorableWhitespaces = bSaveIgnorableWhitespaces;
  m_aEntityResolver = aEntityResolver;
  m_aEntityResolver2 = aEntityResolver instanceof EntityResolver2 ? (EntityResolver2) aEntityResolver : null;
  m_bTrackPosition = bTrackPosition;
}
 
開發者ID:phax,項目名稱:ph-commons,代碼行數:10,代碼來源:MicroSAXHandler.java

示例11: getExternalSubset

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
@Nullable
public InputSource getExternalSubset (final String sName, @Nullable final String sBaseURI) throws SAXException,
                                                                                           IOException
{
  _updatePosition ("getExternalSubset");
  final EntityResolver2 aER2 = m_aEntityResolver2;
  if (aER2 != null)
    return aER2.getExternalSubset (sName, sBaseURI);
  return null;
}
 
開發者ID:phax,項目名稱:ph-commons,代碼行數:11,代碼來源:MicroSAXHandler.java

示例12: XercesBugFixResolver

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
public XercesBugFixResolver(EntityResolver2 fallback) {
    this.fallback = fallback;
}
 
開發者ID:MyCoRe-Org,項目名稱:mycore,代碼行數:4,代碼來源:MCRXMLParserImpl.java

示例13: createEntityResolver

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
public static EntityResolver2 createEntityResolver(Resolver resolver) {
  if (resolver == null)
    throw new NullPointerException();
  return new EntityResolverImpl(resolver);
}
 
開發者ID:relaxng,項目名稱:jing-trang,代碼行數:6,代碼來源:SAX.java

示例14: EntityResolver2Wrapper

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * <p>Creates a new instance wrapping the given SAX entity resolver.</p>
 *
 * @param entityResolver the SAX entity resolver to wrap
 */
public EntityResolver2Wrapper(EntityResolver2 entityResolver) {
    setEntityResolver(entityResolver);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:EntityResolver2Wrapper.java

示例15: setEntityResolver

import org.xml.sax.ext.EntityResolver2; //導入依賴的package包/類
/**
 * <p>Sets the SAX entity resolver wrapped by this object.</p>
 *
 * @param entityResolver the SAX entity resolver to wrap
 */
public void setEntityResolver(EntityResolver2 entityResolver) {
    fEntityResolver = entityResolver;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:EntityResolver2Wrapper.java


注:本文中的org.xml.sax.ext.EntityResolver2類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。