Java Code Examples for org.jsoup.nodes.Element#elementSiblingIndex()

The following examples show how to use org.jsoup.nodes.Element#elementSiblingIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Evaluator.java    From jsoup-learning with MIT License 5 votes vote down vote up
@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() == element.tag()) pos++;
      	}
	return pos;
}
 
Example 2
Source File: Evaluator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 3
Source File: Evaluator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 4
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
    return element.elementSiblingIndex() == index;
}
 
Example 5
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == p.children().size()-1;
}
 
Example 6
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
    return element.elementSiblingIndex() == index;
}
 
Example 7
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected int calculatePosition(Element root, Element element) {
	return element.parent().children().size() - element.elementSiblingIndex();
}
 
Example 8
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
    return root != element && element.elementSiblingIndex() < index;
}
 
Example 9
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == 0;
}
 
Example 10
Source File: Evaluator.java    From jsoup-learning with MIT License 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == p.children().size()-1;
}
 
Example 11
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
protected int calculatePosition(Element root, Element element) {
	return element.elementSiblingIndex()+1;
}
 
Example 12
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == p.children().size()-1;
}
 
Example 13
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
    return element.elementSiblingIndex() < index;
}
 
Example 14
Source File: Evaluator.java    From jsoup-learning with MIT License 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == 0;
}
 
Example 15
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
protected int calculatePosition(Element root, Element element) {
	return element.elementSiblingIndex()+1;
}
 
Example 16
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == 0;
}
 
Example 17
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected int calculatePosition(Element root, Element element) {
	return element.parent().children().size() - element.elementSiblingIndex();
}
 
Example 18
Source File: Evaluator.java    From jsoup-learning with MIT License 4 votes vote down vote up
protected int calculatePosition(Element root, Element element) {
	return element.elementSiblingIndex()+1;
}
 
Example 19
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
    return element.elementSiblingIndex() == index;
}
 
Example 20
Source File: Evaluator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean matches(Element root, Element element) {
	final Element p = element.parent();
	return p != null && !(p instanceof Document) && element.elementSiblingIndex() == 0;
}