本文整理了Java中org.jsoup.parser.Tag.equals()
方法的一些代码示例,展示了Tag.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.equals()
方法的具体详情如下:
包路径:org.jsoup.parser.Tag
类名称:Tag
方法名:equals
暂无
代码示例来源:origin: k9mail/k-9
@NonNull
@Override
public TailFilterDecision tail(Node node, int depth) {
if (signatureFound) {
return TailFilterDecision.CONTINUE;
}
if (node instanceof Element) {
Element element = (Element) node;
boolean elementIsBr = element.tag().equals(BR);
if (elementIsBr || element.tag().equals(P)) {
lastElementCausedLineBreak = true;
brElementPrecedingDashes = elementIsBr ? element : null;
return TailFilterDecision.CONTINUE;
}
}
lastElementCausedLineBreak = false;
return TailFilterDecision.CONTINUE;
}
}
代码示例来源:origin: k9mail/k-9
@NonNull
@Override
public HeadFilterDecision head(Node node, int depth) {
if (signatureFound) {
return HeadFilterDecision.REMOVE;
}
if (node instanceof Element) {
lastElementCausedLineBreak = false;
Element element = (Element) node;
if (element.tag().equals(BLOCKQUOTE)) {
return HeadFilterDecision.SKIP_ENTIRELY;
}
} else if (node instanceof TextNode) {
TextNode textNode = (TextNode) node;
if (lastElementCausedLineBreak && DASH_SIGNATURE_HTML.matcher(textNode.getWholeText()).matches()) {
Node nextNode = node.nextSibling();
if (nextNode instanceof Element && ((Element) nextNode).tag().equals(BR)) {
signatureFound = true;
if (brElementPrecedingDashes != null) {
brElementPrecedingDashes.remove();
brElementPrecedingDashes = null;
}
return HeadFilterDecision.REMOVE;
}
}
}
return HeadFilterDecision.CONTINUE;
}
代码示例来源:origin: org.jsoup/jsoup
@Override
protected int calculatePosition(Element root, Element element) {
int pos = 0;
Elements family = element.parent().children();
for (int i = element.elementSiblingIndex(); i < family.size(); i++) {
if (family.get(i).tag().equals(element.tag())) pos++;
}
return pos;
}
代码示例来源:origin: org.jsoup/jsoup
@Override
public boolean matches(Element root, Element element) {
final Element p = element.parent();
if (p==null || p instanceof Document) return false;
int pos = 0;
Elements family = p.children();
for (Element el : family) {
if (el.tag().equals(element.tag())) pos++;
}
return pos == 1;
}
@Override
代码示例来源:origin: org.jsoup/jsoup
protected int calculatePosition(Element root, Element element) {
int pos = 0;
Elements family = element.parent().children();
for (Element el : family) {
if (el.tag().equals(element.tag())) pos++;
if (el == element) break;
}
return pos;
}
代码示例来源:origin: dhanji/sitebricks
private boolean stackHasValidParent(Tag childTag) {
if (stack.size() == 1 && childTag.equals(htmlTag))
return true; // root is valid for html node
for (int i = stack.size() - 1; i >= 0; i--) {
Node n = stack.get(i);
if (n instanceof Element)
return true;
}
return false;
}
代码示例来源:origin: com.google.sitebricks/sitebricks
private boolean stackHasValidParent(Tag childTag) {
if (stack.size() == 1 && childTag.equals(htmlTag))
return true; // root is valid for html node
for (int i = stack.size() - 1; i >= 0; i--) {
Node n = stack.get(i);
if (n instanceof Element)
return true;
}
return false;
}
代码示例来源:origin: br.com.objectos/sitebricks
private boolean stackHasValidParent(Tag childTag) {
if (stack.size() == 1 && childTag.equals(htmlTag))
return true; // root is valid for html node
for (int i = stack.size() - 1; i >= 0; i--) {
Node n = stack.get(i);
if (n instanceof Element)
return true;
}
return false;
}
代码示例来源:origin: com.google.sitebricks/sitebricks
private Element popStackToClose(Tag tag) {
// first check to see if stack contains this tag; if so pop to there, otherwise ignore
int counter = 0;
Element elToClose = null;
for (int i = stack.size() - 1; i > 0; i--) {
counter++;
Node n = stack.get(i);
if (n instanceof Element) {
Element el = (Element) n;
Tag elTag = el.tag();
if (elTag.equals(bodyTag) || elTag.equals(headTag) || elTag.equals(htmlTag)) { // once in body, don't close past body
break;
} else if (elTag.equals(tag)) {
elToClose = el;
break;
}
}
}
if (elToClose != null) {
for (int i = 0; i < counter; i++) {
stack.removeLast();
}
}
return elToClose;
}
代码示例来源:origin: br.com.objectos/sitebricks
private Element popStackToClose(Tag tag) {
// first check to see if stack contains this tag; if so pop to there, otherwise ignore
int counter = 0;
Element elToClose = null;
for (int i = stack.size() - 1; i > 0; i--) {
counter++;
Node n = stack.get(i);
if (n instanceof Element) {
Element el = (Element) n;
Tag elTag = el.tag();
if (elTag.equals(bodyTag) || elTag.equals(headTag) || elTag.equals(htmlTag)) { // once in body, don't close past body
break;
} else if (elTag.equals(tag)) {
elToClose = el;
break;
}
}
}
if (elToClose != null) {
for (int i = 0; i < counter; i++) {
stack.removeLast();
}
}
return elToClose;
}
代码示例来源:origin: dhanji/sitebricks
private Element popStackToClose(Tag tag) {
// first check to see if stack contains this tag; if so pop to there, otherwise ignore
int counter = 0;
Element elToClose = null;
for (int i = stack.size() - 1; i > 0; i--) {
counter++;
Node n = stack.get(i);
if (n instanceof Element) {
Element el = (Element) n;
Tag elTag = el.tag();
if (elTag.equals(bodyTag) || elTag.equals(headTag) || elTag.equals(htmlTag)) { // once in body, don't close past body
break;
} else if (elTag.equals(tag)) {
elToClose = el;
break;
}
}
}
if (elToClose != null) {
for (int i = 0; i < counter; i++) {
stack.removeLast();
}
}
return elToClose;
}
代码示例来源:origin: code4craft/xsoup
protected int calculatePosition(Element root, Element element) {
int pos = 0;
Elements family = element.parent().children();
for (int i = 0; i < family.size(); i++) {
if (family.get(i).tag().equals(element.tag())) pos++;
if (family.get(i) == element) break;
}
return pos;
}
代码示例来源:origin: us.codecraft/xsoup
protected int calculatePosition(Element root, Element element) {
int pos = 0;
Elements family = element.parent().children();
for (int i = 0; i < family.size(); i++) {
if (family.get(i).tag().equals(element.tag())) pos++;
if (family.get(i) == element) break;
}
return pos;
}
代码示例来源:origin: dhanji/sitebricks
if (en.tag().equals(htmlTag) && (null == _html))
_html = en;
else if (en.tag().equals(htmlTag) && (null != _html))
for (Node cat : en.childNodes()) _html.appendChild(cat);
else if (en.tag().equals(headTag) && (null == _head))
_head = en;
else if (en.tag().equals(headTag) && (null != _head))
for (Node cat : en.childNodes()) _head.appendChild(cat);
else if (en.tag().equals(bodyTag) && (null == _body))
_body = en;
else if (en.tag().equals(bodyTag) && (null != _body))
for (Node cat : en.childNodes()) _body.appendChild(cat);
代码示例来源:origin: com.google.sitebricks/sitebricks
if (en.tag().equals(htmlTag) && (null == _html))
_html = en;
else if (en.tag().equals(htmlTag) && (null != _html))
for (Node cat : en.childNodes()) _html.appendChild(cat);
else if (en.tag().equals(headTag) && (null == _head))
_head = en;
else if (en.tag().equals(headTag) && (null != _head))
for (Node cat : en.childNodes()) _head.appendChild(cat);
else if (en.tag().equals(bodyTag) && (null == _body))
_body = en;
else if (en.tag().equals(bodyTag) && (null != _body))
for (Node cat : en.childNodes()) _body.appendChild(cat);
代码示例来源:origin: br.com.objectos/sitebricks
if (en.tag().equals(htmlTag) && (null == _html))
_html = en;
else if (en.tag().equals(htmlTag) && (null != _html))
for (Node cat : en.childNodes()) _html.appendChild(cat);
else if (en.tag().equals(headTag) && (null == _head))
_head = en;
else if (en.tag().equals(headTag) && (null != _head))
for (Node cat : en.childNodes()) _head.appendChild(cat);
else if (en.tag().equals(bodyTag) && (null == _body))
_body = en;
else if (en.tag().equals(bodyTag) && (null != _body))
for (Node cat : en.childNodes()) _body.appendChild(cat);
代码示例来源: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: 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/dari
Element next = element.nextElementSibling();
if (next != null && BR_TAG.equals(next.tag())) {
next.remove();
Element previousElement = (Element) previousNode;
if (BR_TAG.equals(previousElement.tag())) {
previousBr = previousElement;
&& BR_TAG.equals(((Element) child).tag())) {
if (sawBr) {
continue DIV;
Element paragraph = enhancement.parent();
if (P_TAG.equals(paragraph.tag())) {
Element before = new Element(P_TAG, "");
List<Node> beforeChildren = new ArrayList<Node>();
Element childElement = (Element) child;
if (P_TAG.equals(childElement.tag())
&& !childElement.hasText()
&& childElement.children().isEmpty()) {
代码示例来源:origin: perfectsense/brightspot-cms
Element next = element.nextElementSibling();
if (next != null && BR_TAG.equals(next.tag())) {
next.remove();
Element previousElement = (Element) previousNode;
if (BR_TAG.equals(previousElement.tag())) {
previousBr = previousElement;
&& BR_TAG.equals(((Element) child).tag())) {
if (tag.equals(paragraph.tag())) {
Element before = new Element(tag, "");
List<Node> beforeChildren = new ArrayList<>();
内容来源于网络,如有侵权,请联系作者删除!