本文整理了Java中org.jsoup.nodes.Element.empty()
方法的一些代码示例,展示了Element.empty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.empty()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:empty
[英]Remove all of the element's child nodes. Any attributes are left as-is.
[中]删除元素的所有子节点。所有属性都保持原样。
代码示例来源:origin: org.jsoup/jsoup
/**
* Empty (remove all child nodes from) each matched element. This is similar to setting the inner HTML of each
* element to nothing.
* <p>
* E.g. HTML: {@code <div><p>Hello <b>there</b></p> <p>now</p></div>}<br>
* <code>doc.select("p").empty();</code><br>
* HTML = {@code <div><p></p> <p></p></div>}
* @return this, for chaining
* @see Element#empty()
* @see #remove()
*/
public Elements empty() {
for (Element element : this) {
element.empty();
}
return this;
}
代码示例来源:origin: org.jsoup/jsoup
/**
* Set this element's inner HTML. Clears the existing HTML first.
* @param html HTML to parse and set into this element
* @return this element
* @see #append(String)
*/
public Element html(String html) {
empty();
append(html);
return this;
}
代码示例来源:origin: org.jsoup/jsoup
/**
* Set the text of this element. Any existing contents (text or elements) will be cleared
* @param text unencoded text
* @return this element
*/
public Element text(String text) {
Validate.notNull(text);
empty();
TextNode textNode = new TextNode(text);
appendChild(textNode);
return this;
}
代码示例来源:origin: astamuse/asta4d
public Element empty() {
return originElement.empty();
}
代码示例来源:origin: astamuse/asta4d
@Override
public void set(Element elem) {
elem.empty();
elem.appendText(renderText);
}
代码示例来源:origin: astamuse/asta4d
@Override
public void set(Element elem) {
elem.empty();
elem.appendChild(newChild);
}
代码示例来源:origin: io.committed.krill/krill
private void convertParagraphsToList(final Document document) {
document.select("p,li,td").forEach(p -> {
final String text = p.text();
for (final String symbol : LISTITEM_SYMBOLS) {
if (text.contains(symbol)) {
p.tagName("ul");
p.empty();
for (final String s : text.split(symbol)) {
p.appendElement("li").text(s);
}
// Only do this once!
return;
}
}
});
}
代码示例来源:origin: Cognifide/knotx
private String getFragmentContent(String content, Element scriptContentDocument) {
Document resultDocument = Jsoup.parse(content, "UTF-8", Parser.xmlParser());
Element scriptTag = resultDocument.child(0).empty();
scriptContentDocument.childNodesCopy().forEach(scriptTag::appendChild);
return resultDocument.html();
}
代码示例来源:origin: opentoutatice-ecm.platform/opentoutatice-ecm-platform-core
lastElement.empty();
lastElement.append(innerText);
if (childTruncHtml != null) {
lastElement.empty();
lastElement.append(StringUtils.substringBeforeLast(childTruncHtml, TRUNCATED_HTML_SUFFIX));
代码示例来源:origin: astamuse/asta4d
switch (blockType) {
case ExtNodeConstants.BLOCK_NODE_ATTR_OVERRIDE:
targetBlock.empty();
targetBlock.insertChildren(-1, childNodes);
break;
代码示例来源:origin: basis-technology-corp/Java-readability
document.body().empty();
document.body().appendChild(articleContent);
内容来源于网络,如有侵权,请联系作者删除!