org.ccil.cowan.tagsoup.Parser.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(114)

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

Parser.setProperty介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

/**
 * Returns displayable styled text from the provided HTML string.
 * Any <img> tags in the HTML will use the specified ImageGetter
 * to request a representation of the image (use null if you don't
 * want this) and the specified TagHandler to handle unknown tags
 * (specify null if you don't want this).
 *
 * <p>This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.
 */
public static SpannableStringBuilder fromHtml(String source, ImageGetter imageGetter,
    TagHandler tagHandler) {
  Parser parser = new Parser();
  try {
    parser.setProperty(Parser.schemaProperty, HtmlParser.schema);
  } catch (org.xml.sax.SAXNotRecognizedException e) {
    // Should not happen.
    throw new RuntimeException(e);
  } catch (org.xml.sax.SAXNotSupportedException e) {
    // Should not happen.
    throw new RuntimeException(e);
  }
  HtmlToSpannedConverter converter =
      new HtmlToSpannedConverter(source, imageGetter, tagHandler,
          parser);
  return converter.convert();
}

代码示例来源:origin: apache/tika

parser.setProperty(org.ccil.cowan.tagsoup.Parser.schemaProperty, schema);
parser.setContentHandler(handler);
parser.parse(new InputSource(new StringReader(codeAsHtml)));

代码示例来源:origin: org.ccil.cowan.tagsoup/tagsoup

public void setProperty(String name, Object value)
  throws SAXNotRecognizedException, SAXNotSupportedException
{
  parser.setProperty(name, value);
}

代码示例来源:origin: apache/tika

parser.setProperty(
    org.ccil.cowan.tagsoup.Parser.schemaProperty, schema);

代码示例来源:origin: trezor/trezor-android

/**
 * Returns displayable styled text from the provided HTML string.
 * Any &lt;img&gt; tags in the HTML will use the specified ImageGetter
 * to request a representation of the image (use null if you don't
 * want this) and the specified TagHandler to handle unknown tags
 * (specify null if you don't want this).
 *
 * <p>This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.
 */
public static Spanned fromHtml(String source, ImageGetter imageGetter,
                TagHandler tagHandler) {
  Parser parser = new Parser();
  try {
    parser.setProperty(Parser.schemaProperty, HtmlParser.schema);
  } catch (org.xml.sax.SAXNotRecognizedException e) {
    // Should not happen.
    throw new RuntimeException(e);
  } catch (org.xml.sax.SAXNotSupportedException e) {
    // Should not happen.
    throw new RuntimeException(e);
  }
  HtmlToSpannedConverter converter =
      new HtmlToSpannedConverter(source, imageGetter, tagHandler,
          parser);
  return converter.convert();
}

代码示例来源:origin: org.apache.tika/tika-parsers

parser.setProperty(org.ccil.cowan.tagsoup.Parser.schemaProperty, schema);
parser.setContentHandler(handler);
parser.parse(new InputSource(new StringReader(codeAsHtml)));

代码示例来源:origin: zulip/zulip-android

Parser parser = new Parser();
try {
  parser.setProperty(Parser.schemaProperty, schema);
} catch (SAXNotRecognizedException | SAXNotSupportedException e) {

代码示例来源:origin: org.apache.tika/tika-parsers

parser.setProperty(
    org.ccil.cowan.tagsoup.Parser.schemaProperty, schema);

相关文章