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 7569667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:13:24+00:00 2026-05-30T15:13:24+00:00

I have an html which has tags as follows. parent <li class=pro pic notSold

  • 0

I have an html which has tags as follows.

 parent   <li class="pro pic notSold" status="0" >
 child      <ul><li></li><ul>
 parent   <li class="pro pic soldOut" status="-1" >
 child      <ul><li></li><ul>

there are multiple parent

  • tags as above. I want my loop to work for all
  • parent tags.
    I tried, Elements indProducts = html.select(“li”); This was pulling even the child li. I dont want that.
    I want to code such that if the

  • class starts with pro pic, then it would be considered else skip. What should I do? Is there a select clause that works similar to “like” or something like that.

    • 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-05-30T15:13:26+00:00Added an answer on May 30, 2026 at 3:13 pm

      Yes, jSoup provides something similar to like. Check out this selector usage link.

      You could try something like this:

      import org.jsoup.Jsoup;
      import org.jsoup.nodes.Document;
      import org.jsoup.select.Elements;
      
      
      public class JSoupTest 
      {
          public static void main(String[] args) 
          {
               String html =   "<li class='pro pic notSold' status='0' >";
               html+=      "<ul><li></li><ul>";
               html+=   "<li class='pro pic soldOut' status='-1' >";
               html+=      "<ul><li></li><ul>";
      
               Document doc = Jsoup.parse(html);
               Elements elems = doc.select("[class^=pro pic]");
      
              System.out.println(elems.size());
          }
      }
      

      Output = 2

      Note: Your class starting with pro pic is too generic and will return the outermost parent (and also one inner child).

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

    Sidebar

    Related Questions

    I have a string which has html tags. I want to remove the html
    I have a HTML which has lot of content and a vertical scrollbar appears
    I have an html page which has a link called open. Once the link
    I have this html form which has options: <tr> <td width=30 height=35><font size=3>*List:</td> <td
    I have a base.html which has a login section at the top of every
    I have a table in HTML which has three columns i.e Error - User
    I have a page which has an Html.DropDownList which takes in a viewdata parameter.
    I have a webrequest that returns a html response which has form inside with
    I have seen some mails which has HTML content embedded in them. The content
    We have a CMS which has several thousand text/html files in it. It turns

    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.