本文整理了Java中org.jsoup.safety.Whitelist.<init>()
方法的一些代码示例,展示了Whitelist.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Whitelist.<init>()
方法的具体详情如下:
包路径:org.jsoup.safety.Whitelist
类名称:Whitelist
方法名:<init>
[英]Create a new, empty whitelist. Generally it will be better to start with a default prepared whitelist instead.
[中]创建一个新的空白名单。一般来说,最好从一个默认的白名单开始。
代码示例来源:origin: org.jsoup/jsoup
/**
This whitelist allows only text nodes: all HTML will be stripped.
@return whitelist
*/
public static Whitelist none() {
return new Whitelist();
}
代码示例来源:origin: org.jsoup/jsoup
/**
This whitelist allows only simple text formatting: <code>b, em, i, strong, u</code>. All other HTML (tags and
attributes) will be removed.
@return whitelist
*/
public static Whitelist simpleText() {
return new Whitelist()
.addTags("b", "em", "i", "strong", "u")
;
}
代码示例来源:origin: org.jsoup/jsoup
/**
<p>
This whitelist allows a fuller range of text nodes: <code>a, b, blockquote, br, cite, code, dd, dl, dt, em, i, li,
ol, p, pre, q, small, span, strike, strong, sub, sup, u, ul</code>, and appropriate attributes.
</p>
<p>
Links (<code>a</code> elements) can point to <code>http, https, ftp, mailto</code>, and have an enforced
<code>rel=nofollow</code> attribute.
</p>
<p>
Does not allow images.
</p>
@return whitelist
*/
public static Whitelist basic() {
return new Whitelist()
.addTags(
"a", "b", "blockquote", "br", "cite", "code", "dd", "dl", "dt", "em",
"i", "li", "ol", "p", "pre", "q", "small", "span", "strike", "strong", "sub",
"sup", "u", "ul")
.addAttributes("a", "href")
.addAttributes("blockquote", "cite")
.addAttributes("q", "cite")
.addProtocols("a", "href", "ftp", "http", "https", "mailto")
.addProtocols("blockquote", "cite", "http", "https")
.addProtocols("cite", "cite", "http", "https")
.addEnforcedAttribute("a", "rel", "nofollow")
;
}
代码示例来源:origin: org.jsoup/jsoup
return new Whitelist()
.addTags(
"a", "b", "blockquote", "br", "caption", "cite", "code", "col",
代码示例来源:origin: stackoverflow.com
Whitelist myCustomWhitelist = new Whitelist();
myCustomWhitelist.addTags("b", "em", ...);
代码示例来源:origin: stackoverflow.com
Whitelist whitelist=new Whitelist();
Cleaner cleaner = new Cleaner(whitelist);
whitelist.addAttributes("a","accesskey","dir","lang","style","tabindex","title","href");
cleaner.clean(doc);
代码示例来源:origin: inception-project/inception
public static String cleanHighlight(String aHighlight) {
Whitelist wl = new Whitelist();
wl.addTags("em");
Document dirty = Jsoup.parseBodyFragment(aHighlight, "");
Cleaner cleaner = new Cleaner(wl);
Document clean = cleaner.clean(dirty);
clean.select("em").tagName("mark");
return clean.body().html();
}
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.app/inception-ui-external-search
Whitelist wl = new Whitelist();
wl.addTags("em");
Document dirty = Jsoup.parseBodyFragment(result.getHighlights().get(0), "");
代码示例来源:origin: stackoverflow.com
Whitelist wl = new Whitelist();
代码示例来源:origin: org.finra.herd/herd-core
Whitelist whitelist = new Whitelist();
代码示例来源:origin: FINRAOS/herd
Whitelist whitelist = new Whitelist();
内容来源于网络,如有侵权,请联系作者删除!