search

Home  >  Q&A  >  body text

java - 解析HTML,获取其中想要的信息

遇到一个比较棘手的需求:

  1. 开发语言Java;

  2. 程序定时读取HR邮箱中从前程无忧,智联发过来的简历(已实现,获到简历的HTML);

  3. 从简历HTML中解析获取想要的信息想(姓名,性别,电话,邮箱,工作经历,教育经历等等),保存到数据库中;

  4. 把数据库中的简历数据用HTML展示,可让HR进行筛选;

我现在卡在了简历HTML的解析信息这步,我用比较笨的方法,字符串定位截取,但是这样没办法比较准确的获取到想要信息。。。求助大家,看有没有好方法解析。。

巴扎黑巴扎黑2820 days ago790

reply all(7)I'll reply

  • PHPz

    PHPz2017-04-18 10:22:42

    It is better to use Jsoup to convert it into the corresponding Document object, which is more convenient when operating the corresponding elements.
    jsoup API: http://www.open-open.com/jsoup/

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 10:22:42

    What about using regular expressions? Think more about possible matching formats and it should be OK.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:22:42

    It would be better to use regular capture

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:22:42

    You can use jsoup

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 10:22:42

    You can use JSOUP. I have done something similar before. This is very convenient and can process various tags and so on.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:22:42

    Prefer jsoup.
    jsoup has a select function, which is similar to the syntax of CSS selector. The API is simple and convenient than regular expressions.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:22:42

    1 Regular
    2 HTML parsing library, it seems to be called "mithril" in Chinese

    reply
    0
  • Cancelreply