当前位置: 首页>>代码示例>>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;未经允许,请勿转载。