I have a html files called page1.html, page2.html. In page1.html and page2.html I have a few content inside table element, now I want to extract those table contents and put it in new file called summary.html. I don't know jQuery, so how to do this from Java or Javascript. I know how to create html from Java/Javascript.
1
votes
1 Answers
0
votes
If using Java, the best option I can think of is using JSOUP, a Java HTML parser library.
File input = new File("C:\\page1.html");
Document doc = Jsoup.parse(input, "UTF-8");
Element table = doc.getElementByTag("table");
Elements rows = table.getElementsByTag("tr");
for (Element row : rows) {
String rowText = row.text();
}