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

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

本文整理了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

  1. /**
  2. * Returns displayable styled text from the provided HTML string.
  3. * Any <img> tags in the HTML will use the specified ImageGetter
  4. * to request a representation of the image (use null if you don't
  5. * want this) and the specified TagHandler to handle unknown tags
  6. * (specify null if you don't want this).
  7. *
  8. * <p>This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.
  9. */
  10. public static SpannableStringBuilder fromHtml(String source, ImageGetter imageGetter,
  11. TagHandler tagHandler) {
  12. Parser parser = new Parser();
  13. try {
  14. parser.setProperty(Parser.schemaProperty, HtmlParser.schema);
  15. } catch (org.xml.sax.SAXNotRecognizedException e) {
  16. // Should not happen.
  17. throw new RuntimeException(e);
  18. } catch (org.xml.sax.SAXNotSupportedException e) {
  19. // Should not happen.
  20. throw new RuntimeException(e);
  21. }
  22. HtmlToSpannedConverter converter =
  23. new HtmlToSpannedConverter(source, imageGetter, tagHandler,
  24. parser);
  25. return converter.convert();
  26. }

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

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

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

  1. public void setProperty(String name, Object value)
  2. throws SAXNotRecognizedException, SAXNotSupportedException
  3. {
  4. parser.setProperty(name, value);
  5. }

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

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

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

  1. /**
  2. * Returns displayable styled text from the provided HTML string.
  3. * Any &lt;img&gt; tags in the HTML will use the specified ImageGetter
  4. * to request a representation of the image (use null if you don't
  5. * want this) and the specified TagHandler to handle unknown tags
  6. * (specify null if you don't want this).
  7. *
  8. * <p>This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.
  9. */
  10. public static Spanned fromHtml(String source, ImageGetter imageGetter,
  11. TagHandler tagHandler) {
  12. Parser parser = new Parser();
  13. try {
  14. parser.setProperty(Parser.schemaProperty, HtmlParser.schema);
  15. } catch (org.xml.sax.SAXNotRecognizedException e) {
  16. // Should not happen.
  17. throw new RuntimeException(e);
  18. } catch (org.xml.sax.SAXNotSupportedException e) {
  19. // Should not happen.
  20. throw new RuntimeException(e);
  21. }
  22. HtmlToSpannedConverter converter =
  23. new HtmlToSpannedConverter(source, imageGetter, tagHandler,
  24. parser);
  25. return converter.convert();
  26. }

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

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

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

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

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

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

相关文章