tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Jsoup > Inner HTML

Inner HTML 

Jsoup is an open source java library for parsing and manipulating HTML with ease. Get the latest binaries from http://jsoup.org/. This requires the library jsoup-1.6.1.jar to be in classpath. The following example shows getting the inner html of a tag element.

File Name  :  
com/bethecoder/tutorials/jsoup/tests/InnerHtmlTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jsoup.tests;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class InnerHtmlTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    String html = "<html><body><span class='show'><b>BE THE CODER</b></span></body></html>";
      
    Document doc = Jsoup.parse(html);
    
    Element docBody = doc.body();
    System.out.println(docBody.html());
    
    System.out.println();
    
    Elements bTag = doc.getElementsByTag("b");
    System.out.println(bTag.html());
  }

}
   

It gives the following output,
File Name  :  OUTPUT


                    Print

   



Books Recommendation

 
 
bl  br