當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.nextElementSibling方法代碼示例

本文整理匯總了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;
}
 
開發者ID:virjar,項目名稱:sipsoup,代碼行數:11,代碼來源:FollowingSiblingFunction.java

示例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;
}
 
開發者ID:virjar,項目名稱:sipsoup,代碼行數:9,代碼來源:FollowingSiblingOneFunction.java

示例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;
}
 
開發者ID:Yinqingseu,項目名稱:SeleniumTest,代碼行數:15,代碼來源:AxisSelector.java

示例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;
}
 
開發者ID:Yinqingseu,項目名稱:SeleniumTest,代碼行數:13,代碼來源:AxisSelector.java

示例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>();
    }

}
 
開發者ID:mmjang,項目名稱:quiz_helper,代碼行數:64,代碼來源:JiSho.java


注:本文中的org.jsoup.nodes.Element.nextElementSibling方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。