title: jSoup getting value of HTML tag
body: <p>I am reading an html file from the internet and when I read the file, the output to my console is as follows:</p>
  
  <pre><code>&lt;string&gt;
         &lt;String1&gt;
          text
         &lt;/String1&gt;
         &lt;level2&gt;
          text2
         &lt;/level2&gt;
         &lt;level3&gt;
          text3
         &lt;/level3&gt;
         &lt;level4&gt;
          text4
         &lt;/level4&gt;
         &lt;level5&gt;
           TEXT
         &lt;/level5&gt;
  &lt;/string&gt;
  &lt;string&gt;
             &lt;String2&gt;
              text
             &lt;/String2&gt;
             &lt;level2&gt;
              text2
             &lt;/level2&gt;
             &lt;level3&gt;
              text3
             &lt;/level3&gt;
             &lt;level4&gt;
              text4
             &lt;/level4&gt;
             &lt;level5&gt;
               THIS TEXT
             &lt;/level5&gt;
      &lt;/string&gt;
  </code></pre>
  
  <p>How can I access the level5 text in the second string? I have been trying all day with no luck and would really appreciate some input from someone who knows more about this. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>String line = null;
  
              try {
                  // FileReader reads text files in the default encoding.
                  FileReader fileReader = new FileReader(String.valueOf(doc));
  
                  // Always wrap FileReader in BufferedReader.
                  BufferedReader bufferedReader = new BufferedReader(fileReader);
  
                  while ((line = bufferedReader.readLine()) != null) {
                      Elements tdElements = doc.getElementsByTag("level1");
                      for(Element element : tdElements )
                      {
                          //Print the value of the element
                          System.out.println(element.text());
                      }
  
                  }
  
                  // Always close files.
                  bufferedReader.close();
              } catch (FileNotFoundException ex) {
                  System.out.println(
                          "Unable to open file '" +
                                  doc + "'");
              } catch (IOException ex) {
                  System.out.println(
                          "Error reading file '"
                                  + doc + "'");
                  // Or we could just do this:
                  // ex.printStackTrace();
              }
          }
  //
          catch (IOException e) {
              e.printStackTrace();
          }
  </code></pre>