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


Java JerryFunction類代碼示例

本文整理匯總了Java中jodd.jerry.JerryFunction的典型用法代碼示例。如果您正苦於以下問題:Java JerryFunction類的具體用法?Java JerryFunction怎麽用?Java JerryFunction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JerryFunction類屬於jodd.jerry包,在下文中一共展示了JerryFunction類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPartnerNameFromTransparencyRegister

import jodd.jerry.JerryFunction; //導入依賴的package包/類
private String getPartnerNameFromTransparencyRegister(String string) {

		try {
			File file = new File(SystemUtil.tempDir(), "partner.html");
			NetUtil.downloadFile(
					"http://ec.europa.eu/transparencyregister/public/consultation/displaylobbyist.do?id=" + string,
					file);
			name = "";
			// create Jerry, i.e. document context
			Jerry doc = Jerry.jerry(FileUtil.readString(file));
			// parse
			doc.$("div.panel-body h4").each(new JerryFunction() {

				public boolean onNode(Jerry $this, int index) {

					name = $this.$("b").text();
					return true;
				}
			});

		} catch (IOException e) {
			e.printStackTrace();
		}
		log.info(name);
		return name;
	}
 
開發者ID:TransparencyInternationalEU,項目名稱:lobbycal,代碼行數:27,代碼來源:MeetingService.java

示例2: parse

import jodd.jerry.JerryFunction; //導入依賴的package包/類
public static List<Book> parse(String page, final String username){
    books.clear();
    Jerry doc = Jerry.jerry(page);

  //  final List<Book> books = new ArrayList<Book>();
    doc.$(CLASSNAME).each(new JerryFunction() {
        Book book = new Book(username);

        @Override
        public boolean onNode(Jerry $this, int index) {
            if (index % 8 == 0) {
                book = new Book(username);
                books.add(book);
            }
            BookInjection.init(book, index, $this.text());
            return true;
        }
    });


    return books;
}
 
開發者ID:1994,項目名稱:cdulibrary,代碼行數:23,代碼來源:Analysis.java

示例3: parseCourses

import jodd.jerry.JerryFunction; //導入依賴的package包/類
/**
 * Parses a given Jerry node and returns the courses
 * @param page The Jerry node to be parsed
 * @return A list of parsed courses
 */
private static List<Course> parseCourses(Jerry page) {
    final List<Course> courses = new ArrayList<Course>();
    Node node = page.$(Constants.COURSE_LIST).get(0);
    if (node != null) {
        page.$(Constants.COURSE).each(new JerryFunction() {
            public boolean onNode(Jerry jerry, int i) {
                String[] cName = jerry.text().split("\n");
                String[] href = jerry.attr("href").split("/");
                Course course = new Course(href[href.length - 1].trim(), cName[1].trim());
                courses.add(course);
                return true;
            }
        });
    }
    return courses;
}
 
開發者ID:pielambr,項目名稱:Minerva4J,代碼行數:22,代碼來源:CourseParser.java

示例4: parseAnnouncements

import jodd.jerry.JerryFunction; //導入依賴的package包/類
/**
 * Parses the given Jerry object to a list of announcements
 * @param page The Jerry object to be parsed
 * @return A list of announcements
 */
private static List<Announcement> parseAnnouncements(Jerry page) {
    final List<Announcement> announcements = new ArrayList<Announcement>();
    page.$(Constants.ANNOUNCEMENT_LIST).each(new JerryFunction() {
        public boolean onNode(Jerry jerry, int i) {
            Announcement announcement = parseAnnouncement(jerry);
            if(announcement != null) {
                announcements.add(announcement);
            }
            return true;
        }
    });
    return announcements;
}
 
開發者ID:pielambr,項目名稱:Minerva4J,代碼行數:19,代碼來源:AnnouncementParser.java


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