1
電子郵件地址,我有一個表像這樣如何獲得與jsoup
<TR BGCOLOR="#F9F9F9">
<TD width="1%" nowrap><B>Tel:</B></TD>
<TD>+39 04949 59599</TD>
<TD width="1%" nowrap><B>Email:</B></TD>
<TD><A HREF="javascript:void(0);"
OnClick="Messenger('/do/home.pl/[email protected]')">[email protected]</a></TD>
</TR>
<TR BGCOLOR="#F9F9F9">
<TD width="1%" nowrap><B>Fax:</B></TD>
<TD>+39 304040 303030</TD>
<TD width="1%" nowrap><B>Skype:</B></TD>
<TD></TD>
</TR>
我需要獲得郵件地址,但我有一些問題,因爲我的代碼給我回一個空的文本。我試圖解析表格的整個文本,但結果是除郵件外的所有文本!如果我解析td,或者我使用索引來查找href元素,也是如此。我該如何解決這個問題?
這是代碼中,我試圖
Element info1 = doc.select("table").get(7); //this works
Elements td = info1.select("td");
String telefono="";
String email="";
Element tdtel=info1.select("td").get(1);
telefono = "Tel. :" + tdtel.text(); //this works
Element tdmail=info1.select("td").get(3);
Element linkmail =tdmail.select("a[href]").first(); //error here
看到一些代碼將使一個答案更簡單。 – Henry
我添加了一些代碼;) –