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


Java LSResourceResolver.resolveResource方法代码示例

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


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

示例1: resolveResource

import org.w3c.dom.ls.LSResourceResolver; //导入方法依赖的package包/类
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
    LSInput input = null;
    
    Iterator<ValidatorSchemaFactory> it = mExtSchemaFactories.iterator();
    while(it.hasNext()) {
        ValidatorSchemaFactory fac = it.next();
        LSResourceResolver resolver = fac.getLSResourceResolver();
        if(resolver != null) {
            input = resolver.resolveResource(type, namespaceURI, publicId, systemId, baseURI);
            if(input != null) {
               break;
            }
        }
    }
    
    return input;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:WSDLSchemaValidator.java

示例2: resolveResource

import org.w3c.dom.ls.LSResourceResolver; //导入方法依赖的package包/类
/**
    * @see org.w3c.dom.ls.LSResourceResolver#resolveResource(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
    */
   public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
for (LSResourceResolver resolver: resolvers) {
    LSInput input = resolver.resolveResource(type, namespaceURI, publicId, systemId, baseURI);
    if (input != null) {
	return input;
    }
}
return null;
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:CompoundLSResourceResolver.java

示例3: testOSGIBundle

import org.w3c.dom.ls.LSResourceResolver; //导入方法依赖的package包/类
@Test
public void testOSGIBundle () throws BundleException
{
  LSInput aRes;

  // Initializing Apache Felix as OSGI container is required to get the
  // "bundle" URL protocol installed correctly
  // Otherwise the first call would end up as a "file" resource ;-)
  final Framework aOSGI = new FrameworkFactory ().newFramework (new HashMap <String, String> ());
  aOSGI.start ();
  try
  {
    // Bundle 0 is the org.apache.felix.framework bundle
    final Bundle b = aOSGI.getBundleContext ().getBundle (0);
    assertNotNull (b);
    assertEquals (b.getState (), Bundle.ACTIVE);

    // No leading slash is important as the ClassLoader is used!
    assertNotNull (b.getResource ("org/apache/felix/framework/util/Mutex.class"));

    final LSResourceResolver aRR = new SimpleLSResourceResolver ();

    // No class loader
    aRes = aRR.resolveResource (XMLConstants.W3C_XML_SCHEMA_NS_URI,
                                null,
                                null,
                                "../Felix.class",
                                "bundle://0.0:1/org/apache/felix/framework/util/Mutex.class");
    assertTrue (aRes instanceof ResourceLSInput);
    final IHasInputStream aISP = ((ResourceLSInput) aRes).getInputStreamProvider ();
    assertTrue (aISP instanceof URLResource);
    // Path maybe a "jar:file:" resource
    assertTrue (((URLResource) aISP).getPath ().endsWith ("org/apache/felix/framework/Felix.class"));
  }
  finally
  {
    aOSGI.stop ();
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:40,代码来源:SimpleLSResourceResolverTest.java

示例4: createResolver

import org.w3c.dom.ls.LSResourceResolver; //导入方法依赖的package包/类
public static Resolver createResolver(final LSResourceResolver resourceResolver) {
  return new AbstractResolver() {
    public void resolve(Identifier id, Input input) throws IOException, ResolverException {
      if (input.isResolved())
        return;
      String base = id.getBase();
      String publicId = null;
      String type = null;
      if (id instanceof ExternalIdentifier) {
        publicId = ((ExternalIdentifier)id).getPublicId();
        type = XML_TYPE;
      }
      else if (id instanceof XMLDocumentIdentifier)
        type = ((XMLDocumentIdentifier)id).getNamespaceUri();
      if (type == null) {
        String mediaType = id.getMediaType();
        if (mediaType.indexOf('*') < 0)
          type = IANA_MEDIA_TYPE_URI + mediaType;
      }
      String targetNamespace = null;
      if (id instanceof TargetNamespaceIdentifier)
        targetNamespace = ((TargetNamespaceIdentifier)id).getTargetNamespace();
      LSInput lsInput = resourceResolver.resolveResource(type, targetNamespace, publicId, id.getUriReference(), base);
      if (lsInput == null)
        return;
      input.setEncoding(lsInput.getEncoding());
      input.setUri(lsInput.getSystemId());
      final Reader characterStream = lsInput.getCharacterStream();
      if (characterStream != null) {
        input.setCharacterStream(characterStream);
        return;
      }
      final InputStream byteStream = lsInput.getByteStream();
      if (byteStream != null) {
        input.setByteStream(byteStream);
        return;
      }
      final String stringData = lsInput.getStringData();
      if (stringData != null) {
        input.setCharacterStream(new StringReader(stringData));
        return;
      }
      // we don't support redirecting to a public ID
    }
  };
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:47,代码来源:LS.java


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