本文整理了Java中org.jsoup.parser.Tag.isSelfClosing()
方法的一些代码示例,展示了Tag.isSelfClosing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.isSelfClosing()
方法的具体详情如下:
包路径:org.jsoup.parser.Tag
类名称:Tag
方法名:isSelfClosing
[英]Get if this tag is self closing.
[中]获取此标签是否自动关闭。
代码示例来源:origin: org.jsoup/jsoup
void outerHtmlTail(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
if (!(childNodes.isEmpty() && tag.isSelfClosing())) {
if (out.prettyPrint() && (!childNodes.isEmpty() && (
tag.formatAsBlock() || (out.outline() && (childNodes.size()>1 || (childNodes.size()==1 && !(childNodes.get(0) instanceof TextNode))))
)))
indent(accum, depth, out);
accum.append("</").append(tagName()).append('>');
}
}
代码示例来源:origin: org.jsoup/jsoup
void outerHtmlHead(final Appendable accum, int depth, final Document.OutputSettings out) throws IOException {
if (out.prettyPrint() && (tag.formatAsBlock() || (parent() != null && parent().tag().formatAsBlock()) || out.outline())) {
if (accum instanceof StringBuilder) {
if (((StringBuilder) accum).length() > 0)
indent(accum, depth, out);
} else {
indent(accum, depth, out);
}
}
accum.append('<').append(tagName());
if (attributes != null) attributes.html(accum, out);
// selfclosing includes unknown tags, isEmpty defines tags that are always empty
if (childNodes.isEmpty() && tag.isSelfClosing()) {
if (out.syntax() == Document.OutputSettings.Syntax.html && tag.isEmpty())
accum.append('>');
else
accum.append(" />"); // <img> in html, <img /> in xml
}
else
accum.append('>');
}
代码示例来源:origin: perfectsense/brightspot-cms
String html = element.outerHtml();
if (element.tag().isSelfClosing()) {
viewNodes.add(new StringRichTextViewNode<>(html, htmlToView));
代码示例来源:origin: astamuse/asta4d
Element insertEmpty(Token.StartTag startTag) {
Tag tag = Tag.valueOf(startTag.name());
Element el = new Element(tag, baseUri, startTag.attributes);
insertNode(el);
if (startTag.isSelfClosing()) {
if (tag.isKnownTag()) {
if (tag.isSelfClosing())
tokeniser.acknowledgeSelfClosingFlag(); // if not acked, promulagates error
} else {
// unknown tag, remember this is self closing for output
tag.setSelfClosing();
tokeniser.acknowledgeSelfClosingFlag(); // not an distinct error
}
}
return el;
}
内容来源于网络,如有侵权,请联系作者删除!