• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SystemIDResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: document

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:LoadDocument.java


示例2: resolveURI

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * This will be called by the processor when it encounters
 * an xsl:include, xsl:import, or document() function.
 *
 * @param base The base URI that should be used.
 * @param urlString Value from an xsl:import or xsl:include's href attribute,
 * or a URI specified in the document() function.
 *
 * @return a Source that can be used to process the resource.
 *
 * @throws IOException
 * @throws TransformerException
 */
public Source resolveURI(
        String base, String urlString, SourceLocator locator)
          throws TransformerException, IOException
{

  Source source = null;

  if (null != m_uriResolver)
  {
    source = m_uriResolver.resolve(urlString, base);
  }

  if (null == source)
  {
    String uri = SystemIDResolver.getAbsoluteURI(urlString, base);

    source = new StreamSource(uri);
  }

  return source;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:35,代码来源:SourceTreeManager.java


示例3: retrieveDocument

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:TransformerImpl.java


示例4: documentF

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:LoadDocument.java


示例5: unparsedEntityDecl

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * Receive notification of an unparsed entity declaration.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass to keep track of the unparsed entities
 * declared in a document.</p>
 *
 * @param name The entity name.
 * @param publicId The entity public identifier, or null if not
 *                 available.
 * @param systemId The entity system identifier.
 * @param notationName The name of the associated notation.
 * @throws SAXException Any SAX exception, possibly
 *            wrapping another exception.
 * @see DTDHandler#unparsedEntityDecl
 *
 * @throws SAXException
 */
public void unparsedEntityDecl(String name, String publicId, String systemId,
                               String notationName) throws SAXException
{
  if (null == m_entities) {
    m_entities = new ArrayList<>();
  }

  try {
    systemId = SystemIDResolver.getAbsoluteURI(systemId,
                                               getDocumentBaseURI());
  } catch (Exception e) {
    throw new SAXException(e);
  }

  //  private static final int ENTITY_FIELD_PUBLICID = 0;
  m_entities.add(publicId);

  //  private static final int ENTITY_FIELD_SYSTEMID = 1;
  m_entities.add(systemId);

  //  private static final int ENTITY_FIELD_NOTATIONNAME = 2;
  m_entities.add(notationName);

  //  private static final int ENTITY_FIELD_NAME = 3;
  m_entities.add(name);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:SAX2DTM.java


示例6: unparsedEntityDecl

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * Receive notification of an unparsed entity declaration.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass to keep track of the unparsed entities
 * declared in a document.</p>
 *
 * @param name The entity name.
 * @param publicId The entity public identifier, or null if not
 *                 available.
 * @param systemId The entity system identifier.
 * @param notationName The name of the associated notation.
 * @throws SAXException Any SAX exception, possibly
 *            wrapping another exception.
 * @see org.xml.sax.DTDHandler#unparsedEntityDecl
 *
 * @throws SAXException
 */
public void unparsedEntityDecl(
        String name, String publicId, String systemId, String notationName)
          throws SAXException
{

  if (null == m_entities)
  {
    m_entities = new Vector();
  }

  try
  {
    systemId = SystemIDResolver.getAbsoluteURI(systemId,
                                               getDocumentBaseURI());
  }
  catch (Exception e)
  {
    throw new org.xml.sax.SAXException(e);
  }

  //  private static final int ENTITY_FIELD_PUBLICID = 0;
  m_entities.addElement(publicId);

  //  private static final int ENTITY_FIELD_SYSTEMID = 1;
  m_entities.addElement(systemId);

  //  private static final int ENTITY_FIELD_NOTATIONNAME = 2;
  m_entities.addElement(notationName);

  //  private static final int ENTITY_FIELD_NAME = 3;
  m_entities.addElement(name);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:51,代码来源:SAX2DTM.java


示例7: retrieveDocument

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = _uriResolver.resolve(href, baseURI);
        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:45,代码来源:TransformerImpl.java


示例8: setDocumentURI

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * Define the origin of the document from which the tree was built
 */
public void setDocumentURI(String uri) {
    if (uri != null) {
        setDocumentBaseURI(SystemIDResolver.getAbsoluteURI(uri));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:SAXImpl.java


示例9: retrieveDocument

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * Returns a document either by finding it in the cache or
 * downloading it and putting it in the cache.
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet trs) {
    CachedDocument doc;

String uri = href;
if (baseURI != null && !baseURI.equals("")) {
    try {
        uri = SystemIDResolver.getAbsoluteURI(uri, baseURI);
    } catch (TransformerException te) {
        // ignore
    }
}

    // Try to get the document from the cache first
    if ((doc = lookupDocument(uri)) == null) {
        doc = new CachedDocument(uri);
        if (doc == null) return null; // better error handling needed!!!
        doc.setLastModified(getLastModified(uri));
        insertDocument(uri, doc);
    }
    // If the document is in the cache we must check if it is still valid
    else {
        long now = System.currentTimeMillis();
        long chk = doc.getLastChecked();
        doc.setLastChecked(now);
        // Has the modification time for this file been checked lately?
        if (now > (chk + REFRESH_INTERVAL)) {
            doc.setLastChecked(now);
            long last = getLastModified(uri);
            // Reload document if it has been modified since last download
            if (last > doc.getLastModified()) {
                doc = new CachedDocument(uri);
                if (doc == null) return null;
                doc.setLastModified(getLastModified(uri));
                replaceDocument(uri, doc);
            }
        }

    }

    // Get the references to the actual DOM and DTD handler
    final DOM dom = doc.getDocument();

    // The dom reference may be null if the URL pointed to a
    // non-existing document
    if (dom == null) return null;

    doc.incAccessCount(); // For statistics

    final AbstractTranslet translet = (AbstractTranslet)trs;

    // Give the translet an early opportunity to extract any
    // information from the DOM object that it would like.
    translet.prepassDocument(dom);

    return(doc.getDocument());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:62,代码来源:DocumentCache.java


示例10: setSystemId

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
public void setSystemId(String systemId) {
    if (systemId != null) {
        _systemId = SystemIDResolver.getAbsoluteURI(systemId);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:Stylesheet.java


示例11: retrieveDocument

import com.sun.org.apache.xml.internal.utils.SystemIDResolver; //导入依赖的package包/类
/**
 * This class should only be used as a DOMCache for the translet if the
 * URIResolver has been set.
 *
 * The method implements XSLTC's DOMCache interface, which is used to
 * plug in an external document loader into a translet. This method acts
 * as an adapter between TrAX's URIResolver interface and XSLTC's
 * DOMCache interface. This approach is simple, but removes the
 * possibility of using external document caches with XSLTC.
 *
 * @param baseURI The base URI used by the document call.
 * @param href The href argument passed to the document function.
 * @param translet A reference to the translet requesting the document
 */
@Override
public DOM retrieveDocument(String baseURI, String href, Translet translet) {
    try {
        // Argument to document function was: document('');
        if (href.length() == 0) {
            href = baseURI;
        }

        /*
         *  Fix for bug 24188
         *  Incase the _uriResolver.resolve(href,base) is null
         *  try to still  retrieve the document before returning null
         *  and throwing the FileNotFoundException in
         *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
         *
         */
        Source resolvedSource = null;
        if (_uriResolver != null) {
            resolvedSource = _uriResolver.resolve(href, baseURI);
        }

        if (resolvedSource == null && _useCatalog &&
                _catalogFeatures.get(CatalogFeatures.Feature.FILES) != null)  {
            if (_catalogUriResolver == null) {
                _catalogUriResolver = CatalogManager.catalogResolver(_catalogFeatures);
            }
            resolvedSource = _catalogUriResolver.resolve(href, baseURI);
        }

        if (resolvedSource == null)  {
            StreamSource streamSource = new StreamSource(
                 SystemIDResolver.getAbsoluteURI(href, baseURI));
            return getDOM(streamSource) ;
        }

        return getDOM(resolvedSource);
    }
    catch (TransformerException | CatalogException e) {
        if (_errorListener != null)
            postErrorToListener("File not found: " + e.getMessage());
        return(null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:TransformerImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IHintedType类代码示例发布时间:2022-05-23
下一篇:
Java ManagedChannel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap