Java Reference
In-Depth Information
{
if (buffer.length() > 0)
result.add(buffer.toString());
buffer.setLength(0);
capture = true;
} else if (tag.getName().equalsIgnoreCase("/li"))
{
result.add(buffer.toString());
buffer.setLength(0);
capture = false;
} else if (tag.getName().equalsIgnoreCase(listTypeEnd))
{
result.add(buffer.toString());
break;
}
} else
{
if (capture)
buffer.append((char) ch);
}
}
return result;
}
/**
* Called to login to the site and download a list of
* states or capitals.
* @param uid The user id to use for login.
* @param pwd The password to use for login.
* @param search The search string to use.
* @param type What to search for(s=state,c=capital).
* @throws IOException Thrown if a communication failure occurs
*/
public void process(String uid, String pwd,
String search, String type)
throws IOException
{
String session = login(uid, pwd);
if (session != null)
{
List<String> list = search(session, search, type);
for (String item : list)
{
System.out.println(item);
}
Search WWH ::




Custom Search