I have a html page that I am reading.
If the format I am reading in that page is not present I want to exit and continue with the next page but that is not working.
can you please let me know what I am missing
try
{
Document doc = Jsoup.connect(urlget).get();
Element tables = doc.select("div.itembody");
websiteaddress= tables.text();
}
catch (IOException ee)
{
}
If the get is not having itembody I am seeing a exception:
Exception in thread “main” java.lang.NullPointerException
I want this loop to be continued not the program exsit when there is a exception
doc.selectreturns an object of typeElements(a list of Elements) notElement. If no element in your html matches the query you get an empty list of elements. Change your code to: