|
|
HTMLParser Function |
| Number of input field | : | One |
| Number of output field | : | One |
| Description | CSS Selector |
|---|---|
| Selecting HTML tag (p) name having specified class name (intro) | p.intro |
| Selecting HTML tag having specified id or all div tags with id = "greeting" | div#greeting |
| Selecting element with id greeting | #greeting |
| Selecting element with class name = list mobiles | .list.mobiles |
| Selecting HTML elements having src attribute | [src] |
| Selecting all div having id attribute | div[id] |
| Selecting HTML elements having attribute name starting with data- | [^data-] |
| Selecting HTML elements having specific attribute value | [data-index=2] |
| Selecting HTML elements having data-location attribute value starting with wiki | [data-location^=wiki] |
| Selecting HTML elements having class attribute value ending with tro | [class$=tro] |
| Selecting HTML elements having id attribute value containing eeti | [id*=eeti] |
| Selecting HTML elements having data-name attribute value matching regex | [data-name~=.*sung$] |
| Selecting all child li elements of ul having class name languages | ul.languages li |
| Selecting all child tr elements of table having class name 'tablesorter full' | table.tablesorter.full tr |
| Selecting the first td element | td:nth-of-type(1) |
| Selecting all link (a elements) containing images | a:has(img) |
| Selecting div elements without having id attribute | div:not([id]) |
| Selecting all ul elements not having class "list languages" | ul:not([class=list languages]) |
| Selecting all ul elements having text nokia | ul:contains(nokia) |
| Selecting all div elements having text read | div:contains(read) |
| Selecting all ul elements with text matching with regex pattern "C[+]?" (Character C followed by zero or more + sign) Elements uls = document.select("ul:matches(C[+]?)") | ul:matches(C[+]?) |
............
<table class="tablesorter full" id="summary-table">
<thead>
<tr class="tall">
<th><p>Epic</p></th>
<th><p>Name</p></th>
<th class="right"><p>Price (p)</p></th>
<th class="right"><p>Change</p></th>
<th class="right"><p>%<br/>Change</p></th>
<th class="right"><p>30 day<br/>%</p></th>
<th class="right"><p>Market<br/>Cap (m)</p></th>
<th class="right"><p> </p></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><a href="/web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=3IN">3IN</a></td>
<td><a href="/web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=3IN">3i Infrastructure</a></td>
<td class="right">258.88</td>
<td class="right change-up">0.53</td>
<td class="right change-up">0.21</td>
<td class="right change-up">0.73</td>
<td class="right">2,103.48</td>
<td class="right"><a href="https://web.archive.org/web/20190104110157/https://investor.telegraph.co.uk/papi/v1/services/r/type/3/a/trading-trade/code/LSE:3IN/instruction/B/?WT.mc_id=shares_st_indicesc_20141112&utm_source=shares&utm_medium=st&utm_content=indicesc&utm_campaign=shares_st_indicesc_20141112">Trade now</a></td>
</tr>
<tr class="even">
<td><a href="/web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=888">888</a></td>
<td><a href="/web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=888">888 Holdings</a></td>
<td class="right">164.45</td>
<td class="right change-up">1.85</td>
<td class="right change-up">1.14</td>
<td class="right change-down">-0.87</td>
<td class="right">607.26</td>
<td class="right"><a href="https://web.archive.org/web/20190104110157/https://investor.telegraph.co.uk/papi/v1/services/r/type/3/a/trading-trade/code/LSE:888/instruction/B/?WT.mc_id=shares_st_indicesc_20141112&utm_source=shares&utm_medium=st&utm_content=indicesc&utm_campaign=shares_st_indicesc_20141112">Trade now</a></td>
</tr>
............
/web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=3IN 3i Infrastructure 258.88 0.53 0.21 0.73 2,103.48 Trade now /web/20190104110157/http://shares.telegraph.co.uk/quote/?epic=888 888 Holdings 164.45 1.85 1.14 -0.87 607.26 Trade now