本文整理了Java中org.jsoup.nodes.Element.siblingElements()
方法的一些代码示例,展示了Element.siblingElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.siblingElements()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:siblingElements
[英]Get sibling elements. If the element has no sibling elements, returns an empty list. An element is not a sibling of itself, so will not be included in the returned list.
[中]获取兄弟元素。如果元素没有同级元素,则返回空列表。元素本身不是同级元素,因此不会包含在返回的列表中。
代码示例来源:origin: org.jsoup/jsoup
@Override
public boolean matches(Element root, Element element) {
final Element p = element.parent();
return p!=null && !(p instanceof Document) && element.siblingElements().size() == 0;
}
@Override
代码示例来源:origin: astamuse/asta4d
public Elements siblingElements() {
return originElement.siblingElements();
}
代码示例来源:origin: stackoverflow.com
System.out.println("your Col:");
for (Element element : colElements) {
if (element.ownText().equalsIgnoreCase("CreateTime")) {
System.out.print(element.text());
for (Element sibling : element.siblingElements()) {
System.out.print(", " + sibling.text());
}
}
if (element.ownText().equalsIgnoreCase("CreateUser")) {
System.out.print("\n"+element.text());
for (Element sibling : element.siblingElements()) {
System.out.print(", " + sibling.text());
}
}
}
代码示例来源:origin: stackoverflow.com
final Document doc = Jsoup.parse(new File(".\\test.xml"), "UTF-8");
String tag;
BigDecimal left=new BigDecimal(0);
BigDecimal right=new BigDecimal(0);
for (Element sequence : doc.select("sequence")) {
tag = sequence.attr("tag");
for (Element item : sequence.select("element[name='laterality']")) {
String value="";
if(tag.equals("771b,1030")) value = item.siblingElements().select("element[name='mean_value_snr']").text();
//specify correct name for other sequences here
if(!value.isEmpty()){
if(item.text().equals("L")) left = new BigDecimal(value);
if(item.text().equals("R")) right = new BigDecimal(value);
}else{
left=new BigDecimal(0);
right=new BigDecimal(0);
}
}
System.out.println(tag + ": " + "L mean_value=" + left + " | R mean_value=" + right);
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws Exception {
Document doc = Jsoup
.connect("http://services.runescape.com/m=hiscore_oldschool/hiscorepersonal.ws?user1=Lynx%A0Titan")
.get();
Element contentHiscoresDiv = doc.getElementById("contentHiscores");
Element table = contentHiscoresDiv.child(0);
for (Element row : table.select("tr")) {
Elements tds = row.select("td");
for (Element column : tds) {
if (column.children() != null && column.children().size() > 0) {
Element anchorTag = column.getElementsByTag("a").first();
if (anchorTag != null && anchorTag.text().contains("Attack")) {
System.out.println(anchorTag.text());
Elements attributeSiblings = column.siblingElements();
for (Element attributeSibling : attributeSiblings) {
System.out.println(attributeSibling.text());
}
}
}
}
}
}
代码示例来源:origin: stackoverflow.com
Document doc = Jsoup.parse(html);
Element firstH1 = doc.select("h1").first();
Elements siblings = firstH1.siblingElements();
List<Element> elementsBetween = new ArrayList<Element>();
for (int i = 1; i < siblings.size(); i++) {
代码示例来源:origin: opacapp/opacclient
String label = option.parent().ownText().trim();
if (label.equals("")) {
for (Element a : option.siblingElements()) {
label += a.ownText().trim();
代码示例来源:origin: robohorse/gpversionchecker
Elements elements = document.getElementsContainingOwnText(DIV_VERSION);
for (Element element : elements) {
if (element.siblingElements() != null) {
Elements subElements = element.siblingElements();
for (Element subElement : subElements) {
newVersion = subElement.text();
代码示例来源:origin: opacapp/opacclient
Elements siblings = moreHeader.siblingElements();
int startIndex = moreHeader.elementSiblingIndex();
for (int i = startIndex; i < siblings.size(); i++) {
代码示例来源:origin: uk.gov.dstl.baleen/baleen-collectionreaders
Elements allSiblings = last.siblingElements();
Elements pSiblings = allSiblings.select("p");
Element startSibling = null;
代码示例来源:origin: dstl/baleen
Elements allSiblings = last.siblingElements();
Elements pSiblings = allSiblings.select("p");
Element startSibling = null;
内容来源于网络,如有侵权,请联系作者删除!