Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:40:09+00:00 2026-06-10T14:40:09+00:00

There are a number of resources to parse HTML pages and extract textual content.

  • 0

There are a number of resources to parse HTML pages and extract textual content. Jsoup is an example. In my case, I would like to extract the textual content tagged with the html tags under which each sentence occurs. For example, take this page

<html>
<head><title>Test Page</title>
<body>
<h1>This is a test page</h1>
<p> The goal is to extract <b>textual content <em> with html tags</em> </b> from html pages.
</body>
</html>

I’m expecting the output to be like this:

<h1>This is a test page</h1>
<p> The goal is to extract <b>textual content <em> with html tags</em> </b> from html pages.

In other words, I want to include specific html tags within the textual content of the page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:40:11+00:00Added an answer on June 10, 2026 at 2:40 pm

    To get your result you can use this:

    final String html = "<html>"
            + "<head><title>Test Page</title>"
            + "<body>"
            + "<h1>This is a test page</h1>"
            + "<p> The goal is to extract <b>textual content <em> with html tags</em> </b> from html pages."
            + "</body>"
            + "</html>";
    
    // Parse the String into a Jsoup Document
    Document doc = Jsoup.parse(html);
    Elements body = doc.body().children();
    
    // Do further things here ...
    System.out.println(body);
    

    Instead of the String html you can load a file or a website too – jsoup provides this all.

    In this example body contains the html you posted as result.

    Or do you need to select something like “h1 followed by p tag”?

    However you may take a look at the Jsoup Selector API

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridPanel which should load a maximum number of resources. If there
I have an images array in which there are number of images. Not fixed,
Here is the jsfiddle for what I was testing http://jsfiddle.net/5hhRF/ there is number 1
There are a number of examples out there but yet I can't seem to
There are a number of JSON libraries available for Erlang, and it's not clear
Is there a maximum number of email addresses that can be included in a
Is there a maximum number of trace sources for app.config, and by definition listeners
There is a canvas element with 10 children (polygons). There is a number in
Say I have two files where there is one number per line File 1
I have created custom cell in which there are n number of image views.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.