Java Reference
In-Depth Information
public class ParseChoiceList
{
/**
* Called for each option item that is found.
* @param name The name of the option item.
* @param value The value of the option item.
*/
private void processOption(String name, String value)
{
StringBuilder result = new StringBuilder();
result.append('\"');
result.append(name);
result.append("\",\"");
result.append(value);
result.append('\"');
System.out.println(result.toString());
}
/**
* Advance to the specified HTML tag.
* @param parse The HTML parse object to use.
* @param tag The HTML tag.
* @param count How many tags like this to find.
* @return True if found, false otherwise.
* @throws IOException If an exception occurs while reading.
*/
private boolean advance(ParseHTML parse, String tag, int count)
throws IOException
{
int ch;
while ((ch = parse.read()) != -1)
{
if (ch == 0)
{
if (parse.getTag().getName().equalsIgnoreCase(tag))
{
count--;
if (count <= 0)
return true;
}
}
}
return false;
}
Search WWH ::




Custom Search