本文整理汇总了Java中org.jsoup.nodes.Element.nextElementSibling方法的典型用法代码示例。如果您正苦于以下问题:Java Element.nextElementSibling方法的具体用法?Java Element.nextElementSibling怎么用?Java Element.nextElementSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jsoup.nodes.Element
的用法示例。
在下文中一共展示了Element.nextElementSibling方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public Elements call(Element e, List<String> args) {
Elements rs = new Elements();
Element tmp = e.nextElementSibling();
while (tmp != null) {
rs.add(tmp);
tmp = tmp.nextElementSibling();
}
return rs;
}
示例2: call
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public Elements call(Element e, List<String> args) {
Elements rs = new Elements();
if (e.nextElementSibling() != null) {
rs.add(e.nextElementSibling());
}
return rs;
}
示例3: followingSibling
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
/**
* 节点后面的全部同胞节点following-sibling
* @param e
* @return
*/
public Elements followingSibling(Element e){
Elements rs = new Elements();
Element tmp = e.nextElementSibling();
while (tmp!=null){
rs.add(tmp);
tmp = tmp.nextElementSibling();
}
return rs;
}
示例4: followingSiblingOne
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
/**
* 返回下一个同胞节点(扩展) 语法 following-sibling-one
* @param e
* @return
*/
public Elements followingSiblingOne(Element e){
Elements rs = new Elements();
if (e.nextElementSibling()!=null){
rs.add(e.nextElementSibling());
}
return rs;
}
示例5: wordLookup
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
public List<Definition> wordLookup(String key) {
try {
Document doc = Jsoup.connect(wordUrl + key)
.userAgent("Mozilla")
.timeout(5000)
.get();
Elements entrys = doc.select("div.concept_light");
ArrayList<Definition> defList = new ArrayList<>();
if (entrys.size() > 0) {
for (Element ele : entrys){
String furigana = "";
String writing = "";
String mp3_url = "";
//String meaning_tag = "";
//String definition = "";
Elements furigana_soup = ele.select("span.furigana");
if(furigana_soup.size() > 0){
furigana = furigana_soup.get(0).text().trim();
}
Elements writing_soup = ele.select("span.text");
if(writing_soup.size() > 0){
writing = writing_soup.get(0).text().trim();
}
Elements audio_soup = ele.select("audio > source");
if(audio_soup.size() > 0){
mp3_url = "[sound:" +audio_soup.get(0).attr("src") + "]";
}
Elements meaning_tags_soup = ele.select("div.meaning-tags");
for(Element tag : meaning_tags_soup){
String meaning_tag = tag.text().trim();
Element word_def_soup = tag.nextElementSibling();
if(word_def_soup != null){
for(Element defSoup : word_def_soup.select("div.meaning-definition > span.meaning-meaning")){
HashMap<String, String> defMap = new HashMap<>();
String definition = "<i><font color='grey'>" + meaning_tag + "</font></i> " + defSoup.text().trim();
defMap.put(EXP_ELE[0], writing);
defMap.put(EXP_ELE[1], furigana);
defMap.put(EXP_ELE[2], mp3_url);
//defMap.put(EXP_ELE[3], meaning_tag);
defMap.put(EXP_ELE[3], definition);
String audioIndicator = "";
if(!mp3_url.isEmpty()){
audioIndicator = "<font color='#227D51' >"+AUDIO_TAG + "</font>";
}
String export_html = "<b>" + writing + "</b> <font color='grey'>" + furigana + "</font> " + audioIndicator + "<br/>" + definition;
defList.add(new Definition(defMap, export_html));
}
}
}
}
}
return defList;
} catch (IOException ioe) {
//Log.d("time out", Log.getStackTraceString(ioe));
Toast.makeText(MyApplication.getContext(), Log.getStackTraceString(ioe), Toast.LENGTH_SHORT).show();
return new ArrayList<Definition>();
}
}