Java Reference
In-Depth Information
Recipe #6.1: Extracting Data from a Choice List
Many websites contains choice lists. These choice lists, which are usually part of a form,
allow you to pick one option from a scrolling list of many different options. This recipe will
extract data from the choice list, at the following URL.
http://www.httprecipes.com/1/6/form.php
You can see this list in Figure 6.1.
Figure 6.1: An HTML Choice List
As you can see there is a listing of all fifty US states. This recipe will show how to extract
these states, and their abbreviations. The recipe is shown in Listing 6.4.
Listing 6.4: Parse a Choice List (ParseChoiceList.java)
package com.heatonresearch.httprecipes.ch6.recipe1;
import java.io.*;
import java.net.*;
import com.heatonresearch.httprecipes.html.*;
Search WWH ::




Custom Search