title: Jsoup - How to extract every elements
body: <p>I'm trying to get font information by using Jsoup. For an example:
  <img src="https://i.stack.imgur.com/tyP0D.png" alt="Sample font"></p>
  
  <p>Below is my code:</p>
  
  <pre><code>result = rtfToHtml(new StringReader(streamToString((InputStream)contents.getTransferData(dfRTF))));
                  // Example of text extraction from html
                  // Parse html
                  // String test = result.toString();
                  Document doc = Jsoup.parse(result);
                  // Select first bold text
                  String strdoc = doc.toString();
                  String words[] = strdoc.split("font-family");
                  Element firstBoldElt = doc.select("b").first(); 
                  Elements ele = doc.select("body");
                  String test = ele.toString();
                  Elements all = doc.select("b");
                  String boldtext = all.text();
  </code></pre>
  
  <p>By using the code my output will be like below:</p>
  
  <pre><code>"&lt;body&gt; 
   &lt;p class="default"&gt;
       &lt;span style="color: #000000; font-size: 21pt; font-family: MyriadPro-Bold;"&gt;
           &lt;b&gt;Hello World&lt;/b&gt;
       &lt;/span&gt;
       &lt;span style="color: #000000; font-size: 21pt; font-family: MyriadPro-Bold;"&gt;, Testing&lt;/span&gt; 
       &lt;span style="color: #000000; font-size: 21pt; font-family: MyriadPro-Bold;"&gt;
           &lt;i&gt;&lt;b&gt;Font &lt;/b&gt;&lt;/i&gt;
       &lt;/span&gt;
       &lt;span style="color: #000000; font-size: 21pt; font-family: MyriadPro-Bold;"&gt; Style&lt;/span&gt;
       &lt;span style="color: #000000; font-size: 21pt; font-family: MyriadPro-Bold;"&gt;
           &lt;i&gt;Check&lt;/i&gt;
       &lt;/span&gt;
       &lt;span style="color: #000000; font-size: 10pt; font-family: MyriadPro-Bold;"&gt;&lt;/span&gt;
  &lt;/p&gt;   
  &lt;/body&gt;"
  </code></pre>
  
  <p>I can extract first <strong>BOLD</strong> element or all <strong>BOLD</strong> element but how do I can all element similar like this.</p>
  
  <pre><code>&lt;b&gt;Hello World&lt;/b&gt;
  , Testing
  &lt;i&gt;&lt;b&gt;Font &lt;/b&gt;&lt;/i&gt;
   Style 
  &lt;i&gt;Check&lt;/i&gt; 
  </code></pre>
  
  <p>Any advice or references is highly appreciated.<br>
  <strong>EDITED</strong>                                  </p>
  
  <pre><code>&lt;body lang="en-MY" dir="LTR"&gt; 
   &lt;p style="margin-bottom: 0in"&gt;
   &lt;font color="#000000"&gt; &lt;font face="ArialMT, serif"&gt; &lt;font size="2"&gt;
   &lt;span style="font-style: normal"&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;b&gt;BOLD &lt;/b&gt;
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;span style="font-style: normal"&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;span style="font-weight: normal"&gt;
   REGULAR 
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;span style="font-style: normal"&gt;
   &lt;u&gt;
   &lt;span style="font-weight: normal"&gt;
   UNDERLINED
   &lt;/span&gt;
   &lt;/u&gt;
   &lt;/span&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;span style="font-style: normal"&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;span style="font-weight: normal"&gt; 
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;i&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;span style="font-weight: normal"&gt;
   ITALIC
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/i&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;span style="font-style: normal"&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;span style="font-weight: normal"&gt; 
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/span&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;
   &lt;font color="#000000"&gt;&lt;font face="ArialMT, serif"&gt;&lt;font size="2"&gt;
   &lt;i&gt;
   &lt;span style="text-decoration: none"&gt;
   &lt;b&gt;BOLDITALIC&lt;/b&gt;
   &lt;/span&gt;
   &lt;/i&gt;&lt;/font&gt;
   &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  
  &lt;/body&gt;
  </code></pre>