---
title: "jsoup的使用"
author: "liuna2011"
date: "2012-07-18T14:39:35Z"
tags: []
categories: ["编程语言"]
slug: "jsoup"
draft: false
lastmod: "2012-07-18T14:39:35Z"
id: 1597572
url: "https://liuna2011.iteye.com/blog/1597572"
---

```java

        Document doc = Jsoup.parse(responseString);
        Element content = doc.select("a[href=/478210740_tianjishuma.html]").first().firstElementSibling();

        if (content != null) {
            String tmgnum = content.text();
            System.out.println(tmgnum);
        }

```



```java

rString = rString.replace("积分：","num");
rString = rString.replace("分","");
Document doc = Jsoup.parse(rString);
Element content = doc.select("td:contains(num)").first();
if (content != null) {
    String count = content.text().substring(3);
    user.setOnline(count);
}

Element email = doc.select("font[color=green]").first();
if(email!=null){
   user.setValidate(email.text());}
   return user;
}

```


```java

Element content2 = doc.getElementById("Top1_lblStates");
Element content5 = doc.select("#Top1_lblSurCount a").first();
```

参考：
<http://www.iteye.com/topic/1010582>
<http://www.ibm.com/developerworks/cn/java/j-lo-jsouphtml/>