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