本文整理了Java中org.jsoup.nodes.TextNode.isBlank()
方法的一些代码示例,展示了TextNode.isBlank()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextNode.isBlank()
方法的具体详情如下:
包路径:org.jsoup.nodes.TextNode
类名称:TextNode
方法名:isBlank
[英]Test if this text node is blank -- that is, empty or only whitespace (including newlines).
[中]测试此文本节点是否为空——即为空或仅为空白(包括换行符)。
代码示例来源:origin: org.jsoup/jsoup
/**
Test if this element has any text content (that is not just whitespace).
@return true if element has non-blank text content.
*/
public boolean hasText() {
for (Node child: childNodes) {
if (child instanceof TextNode) {
TextNode textNode = (TextNode) child;
if (!textNode.isBlank())
return true;
} else if (child instanceof Element) {
Element el = (Element) child;
if (el.hasText())
return true;
}
}
return false;
}
代码示例来源:origin: org.jsoup/jsoup
private void normaliseTextNodes(Element element) {
List<Node> toMove = new ArrayList<>();
for (Node node: element.childNodes) {
if (node instanceof TextNode) {
TextNode tn = (TextNode) node;
if (!tn.isBlank())
toMove.add(tn);
}
}
for (int i = toMove.size()-1; i >= 0; i--) {
Node node = toMove.get(i);
element.removeChild(node);
body().prependChild(new TextNode(" "));
body().prependChild(node);
}
}
代码示例来源:origin: org.jsoup/jsoup
void outerHtmlHead(Appendable accum, int depth, Document.OutputSettings out) throws IOException {
if (out.prettyPrint() && ((siblingIndex() == 0 && parentNode instanceof Element && ((Element) parentNode).tag().formatAsBlock() && !isBlank()) || (out.outline() && siblingNodes().size()>0 && !isBlank()) ))
indent(accum, depth, out);
boolean normaliseWhite = out.prettyPrint() && parent() instanceof Element
&& !Element.preserveWhitespace(parent());
Entities.escape(accum, coreValue(), out, false, normaliseWhite, false);
}
代码示例来源:origin: perfectsense/brightspot-cms
private Element nextTag(Tag tag, Element current) {
Element nextTag = null;
for (Node nextNode = current;
(nextNode = nextNode.nextSibling()) != null;) {
if (nextNode instanceof Element) {
Element nextElement = (Element) nextNode;
if (tag.equals(nextElement.tag())) {
nextTag = nextElement;
}
break;
} else if (nextNode instanceof TextNode
&& !((TextNode) nextNode).isBlank()) {
break;
}
}
return nextTag;
}
代码示例来源:origin: pnikosis/jHTML2Md
MDLine line = getLastLine(lines);
if (line.getContent().equals("")) {
if (!textNode.isBlank()) {
line.append(textNode.text().replaceAll("#", "/#").replaceAll("\\*", "/\\*"));
代码示例来源:origin: perfectsense/dari
private Element nextTag(Tag tag, Element current) {
Element nextTag = null;
for (Node nextNode = current;
(nextNode = nextNode.nextSibling()) != null;
) {
if (nextNode instanceof Element) {
Element nextElement = (Element) nextNode;
if (tag.equals(nextElement.tag())) {
nextTag = nextElement;
}
break;
} else if (nextNode instanceof TextNode
&& !((TextNode) nextNode).isBlank()) {
break;
}
}
return nextTag;
}
代码示例来源:origin: perfectsense/brightspot-cms
&& !((TextNode) previousNode).isBlank()) {
break;
&& ((TextNode) next).isBlank())) {
break;
&& ((TextNode) next).isBlank())) {
break;
if (!((TextNode) child).isBlank()) {
continue DIV;
代码示例来源:origin: perfectsense/dari
&& !((TextNode) previousNode).isBlank()) {
break;
&& ((TextNode) next).isBlank())) {
break;
&& ((TextNode) next).isBlank())) {
break;
if (!((TextNode) child).isBlank()) {
continue DIV;
内容来源于网络,如有侵权,请联系作者删除!