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


Java Identifier类代码示例

本文整理汇总了Java中com.thaiopensource.resolver.Identifier的典型用法代码示例。如果您正苦于以下问题:Java Identifier类的具体用法?Java Identifier怎么用?Java Identifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: resolve

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
public SAXSource resolve(Identifier id) throws SAXException, IOException {
  SAXInput input = new SAXInput();
  try {
    resolver.resolve(id, input);
    if (!input.isResolved())
      input.setUri(BasicResolver.resolveUri(id));
    InputSource inputSource = SAX.createInputSource(id, input);
    XMLReader xr = input.getXMLReader();
    if (xr == null)
      xr = createXMLReader();
    return new SAXSource(xr, inputSource);
  }
  catch (ResolverException e) {
    throw SAX.toSAXException(e);
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:17,代码来源:SAXResolver.java

示例2: createResolver

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
public static Resolver createResolver(final URIResolver uriResolver) {
  return new AbstractResolver() {
    public void resolve(Identifier id, Input input) throws IOException, ResolverException {
      if (input.isResolved())
        return;
      Source source;
      try {
        source = uriResolver.resolve(id.getUriReference(), id.getBase());
      }
      catch (TransformerException e) {
        throw toResolverException(e);
      }
      if (source == null)
        return;
      if (source instanceof SAXSource) {
        setInput(input, (SAXSource)source);
        return;
      }
      InputSource in = SAXSource.sourceToInputSource(source);
      if (in != null) {
        SAX.setInput(input, in);
        return;
      }
      // XXX handle StAXSource
      throw new ResolverException("URIResolver returned unsupported subclass of Source");
    }
  };
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:29,代码来源:Transform.java

示例3: resolve

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
public void resolve(Identifier id, Input input) throws IOException, ResolverException {
  if (input.isResolved())
    return;
  String publicId;
  String entityName = null;
  if (id instanceof ExternalIdentifier) {
    publicId = ((ExternalIdentifier)id).getPublicId();
    if (id instanceof ExternalEntityIdentifier)
      entityName = ((ExternalEntityIdentifier)id).getEntityName();
    else if (id instanceof ExternalDTDSubsetIdentifier)
      entityName = "[dtd]";
  }
  else {
    if (!promiscuous)
      return;
    publicId = null;
  }
  try {
    InputSource inputSource;
    if (entityName != null && entityResolver2 != null)
      inputSource = entityResolver2.resolveEntity(entityName,
                                                  publicId,
                                                  id.getBase(),
                                                  id.getUriReference());
    else
      inputSource = entityResolver.resolveEntity(publicId, getSystemId(id));
    if (inputSource != null)
      setInput(input, inputSource);
  }
  catch (SAXException e) {
    throw toResolverException(e);
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:34,代码来源:SAX.java

示例4: getSystemId

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
static String getSystemId(Identifier id) {
  try {
    return BasicResolver.resolveUri(id);
  }
  catch (ResolverException e) { }
  return id.getUriReference();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:8,代码来源:SAX.java

示例5: createInputSource

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
static InputSource createInputSource(Identifier id, Input input) {
  InputSource inputSource = createInputSource(input);
  if (id instanceof ExternalIdentifier)
    inputSource.setPublicId(((ExternalIdentifier)id).getPublicId());
  if (inputSource.getSystemId() == null)
    inputSource.setSystemId(getSystemId(id));
  return inputSource;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:9,代码来源:SAX.java

示例6: resolve

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
public void resolve(Identifier id, Input input) throws
    IOException,
    ResolverException
{
  if (!input.isResolved())
  {
    input.setUri(resolveUri(id));
  }
}
 
开发者ID:jcdarwin,项目名称:epubcheck-web,代码行数:10,代码来源:XMLValidator.java

示例7: createResolver

import com.thaiopensource.resolver.Identifier; //导入依赖的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

示例8: resolve

import com.thaiopensource.resolver.Identifier; //导入依赖的package包/类
public void resolve(Identifier id, Input input) {
    URI baseUri = parseUri(id.getBase());
    URI resolved = baseUri.resolve(id.getUriReference());
    input.setUri(resolved.toString());
    input.setByteStream(uriToResource(resolved));
}
 
开发者ID:ktisha,项目名称:snuggletex,代码行数:7,代码来源:ClassPathResolver.java


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