本文整理了Java中org.ccil.cowan.tagsoup.Parser.setProperty()
方法的一些代码示例,展示了Parser.setProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.setProperty()
方法的具体详情如下:
包路径:org.ccil.cowan.tagsoup.Parser
类名称: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 <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 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);
内容来源于网络,如有侵权,请联系作者删除!