gpt4 book ai didi

org.zkoss.zsoup.Zsoup.parse()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:39:35 25 4
gpt4 key购买 nike

本文整理了Java中org.zkoss.zsoup.Zsoup.parse()方法的一些代码示例,展示了Zsoup.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zsoup.parse()方法的具体详情如下:
包路径:org.zkoss.zsoup.Zsoup
类名称:Zsoup
方法名:parse

Zsoup.parse介绍

[英]Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.
[中]将文件内容解析为HTML。文件的位置用作基本URI,以限定相对URL。

代码示例

代码示例来源:origin: org.zkoss.zk/zhtml

public org.zkoss.idom.Document parse(URL url) throws Exception {
  InputStream inStream = null;
  try {
    if (log.isDebugEnabled())
      log.debug("Parsing file: [" + url.toString() + "]");
    inStream = url.openStream();
    return convertToIDOM(
        Zsoup.parse(inStream, "UTF-8", url.getFile(), Parser.xhtmlParser()));
  } catch (UiExceptionX ue) {
    throw ue;
  } catch (ExceptionInfo e) {
    Document currentDocument = e.getCurrentDocument();
    if (currentDocument != null) {
      currentDocument.outputSettings(currentDocument.outputSettings().prettyPrint(false));
      throw new UiException(" at [file:" + url.getFile() + ", "
          + getLineNumber(new Scanner(currentDocument.toString())) + "]", e);
    } else
      throw new UiException(" at [file:" + url.getFile() + "]", e);
  } finally {
    if (inStream != null)
      inStream.close();
  }
}

代码示例来源:origin: org.zkoss.zk/zhtml

public org.zkoss.idom.Document parse(Reader reader) throws Exception {
  ReaderInputStream inputStream = null;
  try {
    if (log.isDebugEnabled())
      log.debug("Parsing reader: [" + reader + "]");
    inputStream = new ReaderInputStream(reader);
    return convertToIDOM(Zsoup.parse(inputStream, "UTF-8", null, Parser.xhtmlParser()));
  } catch (UiExceptionX ue) {
    String lineNumber = getLineNumber(reader, ue.getKeyword());
    if (lineNumber != null)
      throw new UiException(ue.getMessage() + lineNumber);
    else
      throw ue;
  } finally {
    if (inputStream != null)
      inputStream.close();
  }
}

代码示例来源:origin: org.zkoss.zats/zats-mimic

Document doc = Zsoup.parse(new ByteArrayInputStream(raw.getBytes("utf-8")), "UTF-8",
    "", org.zkoss.zsoup.parser.Parser.xhtmlParser());
Elements scripts = doc.getElementsByTag("script");

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com