当前位置: 首页>>代码示例>>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;未经允许,请勿转载。