本文整理了Java中org.jsoup.nodes.TextNode.nextSibling()
方法的一些代码示例,展示了TextNode.nextSibling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextNode.nextSibling()
方法的具体详情如下:
包路径:org.jsoup.nodes.TextNode
类名称:TextNode
方法名:nextSibling
暂无
代码示例来源:origin: jungilhan/awesome-blogs-android
@Override
public void handleTextNode(TextNode node, DocumentConverter converter) {
// Override to provide special handling for ignoring
// leading or trailing all-space nodes.
if((node.previousSibling() != null && node.nextSibling() != null) ||
node.text().trim().length() != 0) {
super.handleTextNode(node, converter);
}
}
代码示例来源:origin: org.eclipse.mylyn.docs/org.eclipse.mylyn.wikitext
private void removeWhitespaceBefore(Element element) {
Node previousSibling = element.previousSibling();
if (previousSibling instanceof TextNode) {
TextNode textNode = (TextNode) previousSibling;
String text = textNode.getWholeText();
int startOfTrailingWhitespace = lastIndexOfNonWhitespace(text) + 1;
if (startOfTrailingWhitespace <= 0) {
textNode.remove();
} else if (startOfTrailingWhitespace < text.length()) {
textNode.splitText(startOfTrailingWhitespace);
textNode.nextSibling().remove();
}
}
}
代码示例来源:origin: jungilhan/awesome-blogs-android
private String getTextNodeText(TextNode tn, boolean normalText) {
String input = normalText ? tn.text() : tn.getWholeText();
Node prev = tn.previousSibling();
Node next = tn.nextSibling();
boolean parentIsBlock = isBlock(tn.parent());
if(isBlock(prev)) {
input = ltrim(input);
} else if(prev == null && parentIsBlock) {
input = ltrim(input);
} else if(normalText && prev instanceof TextNode) {
TextNode tprev = (TextNode)prev;
if(EMPTY_MATCHER.matcher(tprev.text()).matches()) {
input = ltrim(input);
}
}
if(input.length() > 0) {
if(isBlock(next)) {
input = rtrim(input);
} else if(next == null && parentIsBlock) {
input = rtrim(input);
} else if(normalText && next instanceof TextNode) {
TextNode tnext = (TextNode)next;
if(EMPTY_MATCHER.matcher(tnext.text()).matches()) {
input = rtrim(input);
}
}
}
return input;
}
代码示例来源:origin: org.eclipse.mylyn.docs/org.eclipse.mylyn.wikitext
textNode = (TextNode) textNode.nextSibling();
textNode.remove();
computeAfterTarget(element).after(textNode);
内容来源于网络,如有侵权,请联系作者删除!