title: Jsoup getElementsByTag
body: <p>I am creating an app for my school to make it easier to check what lesson you have. im using their site but they obiously dont have a simple API. so i need to like read the site down and get everything out in pieces. (the single tags in deep in layers of tables).<br>
  so this is what i am currently using:<br></p>
  
  <pre><code>doc.body().getElementsByTag("div").get(0).getElementsByTag("table").get(1).getElementsByTag("tbody").get(0).getElementsByTag("tr").get(1).getElementsByTag("td").get(0).getElementsByTag("table").get(0).getElementsByTag("tbody").get(0).getElementsByTag("tr").get(0).getElementsByTag("td").get(0).getElementsByTag("a").get(0).html()
  </code></pre>
  
  <p>doc = Jsoup parsed document.<br>
  for this code it works all fine, but as soon as i i try this:</p>
  
  <pre><code>doc.body().getElementsByTag("div").get(0).getElementsByTag("table").get(1).getElementsByTag("tbody").get(0).getElementsByTag("tr").get(2).getElementsByTag("td").get(0).getElementsByTag("table").get(0).getElementsByTag("tbody").get(0).getElementsByTag("tr").get(0).getElementsByTag("td").get(0).getElementsByTag("a").get(0).html()
  </code></pre>
  
  <p>it returns an error.<br></p>
  
  <pre><code>03-02 11:30:14.239  15253-15280/? D/JM﹕ Stack [1]: java.util.ArrayList.get(ArrayList.java:308)
  03-02 11:30:14.239  15253-15280/? D/JM﹕ Stack [2]: com.jmtech.jordi.mwc.BackgroundWorker.update_r_n(BackgroundWorker.java:374)
  03-02 11:30:14.239  15253-15280/? D/JM﹕ Stack [3]: com.jmtech.jordi.mwc.BackgroundWorker.access$500(BackgroundWorker.java:54)
  03-02 11:30:14.239  15253-15280/? D/JM﹕ Stack [4]: com.jmtech.jordi.mwc.BackgroundWorker$UpdateRaster_Raster_Notify.run(BackgroundWorker.java:355)
  03-02 11:30:14.239  15253-15280/? D/JM﹕ Stack [5]: java.util.Timer$TimerImpl.run(Timer.java:284)
  03-02 11:30:14.239  15253-15280/? D/JM﹕ java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  </code></pre>
  
  <p><br>
  this is the schools site: <a href="http://maaswaal.roosternet.nl/?les=3H1" rel="nofollow">http://maaswaal.roosternet.nl/?les=3H1</a><br>
  i cant copy&amp;paste HTML because Stackoverflow's question div transfers code to the site, sorry.<br>Thanks for your time to respond already<br></p>