0
<div class="eight columns">
<form method="post" action="http://www.way2franchise.com/search/filter_franchise">

<div style="margin-bottom:10px;margin-top:20px;">

<select name="industry" id="industry" class="searchBoxSel" title="Select Industry">

<option value="candies_and_confectioneries">Candies and Confectioneries</option>
<option value="childrens_services"> Children's Services</option>
<option value="sports_and_recreatio">Sports &amp; Recreation</option>
<option value="staffing_franchises">Staffing Franchises</option>

<div style="margin-bottom:10px;">
<select name="investment" id="investment" class="searchBoxSel" title="Select     Investment">

<option value="">Select Investment</option>
<option value="2500000">Under Rs.2,500,000</option>
<option value="10000000">Under Rs.10,000,000</option>
<option value="50000000">Under Rs.50,000,000</option>
</select>
</div>


<div style="margin-bottom:10px;">
<select class="searchBoxSel" title="Select State" id="state" name="state">
<option value="">Select State</option>
<option value="Andaman and Nicobar Islands">Andaman and Nicobar</option>
<option value="Andhra Pradesh">Andhra Pradesh</option>
<option value="Arunachal Pradesh">Arunachal Pradesh</option>

</select>
</div>
</form></div>

    Here, I need to get the option value pair in an array.While testing the code out i executed the following code:

     String q=doc.select("eight columns").text();
     System.out.println(q); 

使用 Jsoup 选择器语法,我应该将整个代码放入字符串 'q' 中。但我得到的是一个空值(logcat)。如何?

还有 doc.select("h3.r > a> p >h1") 是什么意思?我没有找到任何关于此的好的教程。即使 jsoup 食谱也没有从更广泛的方面解释这些概念。

我经历了 DOM 概念,如父、兄弟概念。在那里我阅读了有关节点的概念。所以在写一些东西作为 Elements e=doc 时。.... 或元素 e=doc

我们可以代替创建节点吗?这可行吗,推荐?

我几乎无法从 html 中转义字符串中的值。

4

1 回答 1

0

如果你想获得类“八列”,你可以使用 getElementsByClass() 例子:

Elements eightcolumns = doc.getElementsByClass("eight columns");
            String str = eightcolumns.first().text();

或选择():

 Elements eightcolumns = doc.select("div.eight columns");
            String str = eightcolumns.first().text();
于 2013-03-11T20:00:37.727 回答