Click here to Skip to main content
15,886,794 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was working on a maven project that allows me to parse a html data from a website. I was able to parse it using this code below:
Java
String url = "http://www.example.com";
        Document doc = Jsoup.connect(url).get();
        Element divNws = doc.select("div.nws").first(); //div with a class=nws
        String divNwsText = divNws.text();
        System.out.println( "The coloum is  " + divNwsText );


So far I have no problems. I can parse the html data. I was using select method from jsoup and retrieving data using "div.col-section" which means I'm looking for div element with the class is col-section. I wanted to print the data in a textarea. The result that I have is a huge one paragraph even though the real data on the website is more than one paragraphs. So how to parse the data just like the one on the website?
Posted
Updated 13-Oct-14 9:56am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900