0

I am trying to insert some Strings in an Elements Jsoup object. Here is what I have done so far:

Elements hrefs = null;
Elements div = null;
Elements atag = null;

div = doc.select("div#id1");
atag = div.select("a.class1");

for (Element ahref : atag){

         String wholeURL = "<a href='http://www.example.com" + ahref.attr("href")+ "'>more</a>";
         Document docu = Jsoup.parse(wholeURL, "", Parser.xmlParser());
         hrefs.add(docu); // <-- here I get NullPointerException

}

I tried to use Elements hrefs.add() but I get nullPointerException. Any thoughts?

yasuo
  • 37
  • 6

0 Answers0