Java Reference
In-Depth Information
buffer.setLength(0);
capture = false;
} else if (tag.getName().equalsIgnoreCase("/table"))
{
break;
}
} else
{
if (capture)
buffer.append((char) ch);
}
}
}
/**
* The main method, create a new instance of the object and call
* process.
* @param args not used.
*/
public static void main(String args[])
{
try
{
URL u = new URL("http://www.httprecipes.com/1/6/table.php");
ParseTable parse = new ParseTable();
parse.process(u, 2);
} catch (Exception e)
{
e.printStackTrace();
}
}
}
An HTML table is contained between the tags <table> and </table> . The table
is made up of a series of rows, which are contained between the <tr> and </tr> tags.
Each table row contains several columns, each of which is contained between the <td> and
</td> tags. Additionally, some tables have header columns which are contained between
<th> and </th> tags.
The HTML for the states table is shown below.
<table border="1">
<tr>
<th>Name</th>
<th>Code</th>
<th>Capital</th>
<th>Link</th>
Search WWH ::




Custom Search