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

  • Home
  • SEARCH
  • 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 6578397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:45:59+00:00 2026-05-25T15:45:59+00:00

I am trying to parse this content using jsoup. <div class=imageInlineCenter style=width: 468px; align=center><img

  • 0

I am trying to parse this content using jsoup.

<div class="imageInlineCenter" style="width: 468px;" align="center"><img src="http://xbox360media.ign.com/xbox360/image/article/117/1171345/MW3_3_468_1306710207.jpg" align="middle" border="0" height="263" width="468"><div class="inlineImageCaption" style="width: 468px;">Your subwoofer will get a break during the stealthy start of the 'Mind the Gap' level, but only briefly.</div></div>

I only want to parse the img src tag to get the image url.

Here’s what I am working with right now..

  try{
                  Elements img = jsDoc.select("div.imageInlineCenter");
                  String imgSrc = img.attr("img src");
                  System.out.println(imgSrc);



                 }
                 catch(Exception e){

                     Log.e("UPCOMING", "Couldnt retrieve the text");
                           }

Nothing is being printed out. Instead i am getting the message that it couldnt retrieve it.

How can i parse this?

EDIT:

Here is the code I am using.

It’s not showing the catch message, or the system.out.

   try {
                 jsDoc = Jsoup.connect(url).get();

                  try{
                      Elements img = jsDoc.select("div.imageInlineCenter img[src]");
                      String imgSrc = img.attr("src");
                      System.out.println(imgSrc);





                     }
                     catch(Exception e){

                         Log.e("UPCOMING", "Couldnt retrieve the text");
                               }
  • 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-25T15:45:59+00:00Added an answer on May 25, 2026 at 3:45 pm

    This is wrong:

    String imgSrc = img.attr("img src");
    

    img is a tag not an attribute. src is an attribute of course.

    Can’t test it right now, but what about something like…

    Elements img = jsDoc.select("div.imageInlineCenter img[src]");
    String imgSrc = img.attr("src");
    System.out.println(imgSrc);
    

    Edit 1
    Regarding “it didn’t seem to work…”: it seemed to work fine for me. How are you testing this?

    import java.io.IOException;
    import org.jsoup.Jsoup;
    import org.jsoup.nodes.Document;
    import org.jsoup.select.Elements;
    
    public class Foo003 {
       private static final String TEST_URL_1 = "http://xbox360.ign.com/" +
            "articles/117/1171345p1.html";
    
       public static void main(String[] args) {
          Document jsDoc = null;
    
          try {
             jsDoc = Jsoup.connect(TEST_URL_1).get();
             // System.out.println(jsDoc);
    
             Elements img = jsDoc.select("div.imageInlineCenter img[src]");
             String imgSrc = img.attr("src");
             System.out.println(imgSrc);
    
          } catch (IOException e) {
             e.printStackTrace();
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using http://www.asual.com/jquery/address/ plugin and trying to parse some url, this is what
I have a problem when trying to parse a webpage using jSoup. If I
I am trying to figure out the best way to parse this comma delimited
I'm trying to parse an INI file using C++. Any tips on what is
I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial
I am trying to parse an RSS feed using Linq to XML like so:
I am trying to write XML data using Stax where the content itself is
I am new to jquery. I am trying to parse xml string using jquery.
I am trying to scrape some content from an HTML page. I'm using libxml2
I'm trying to parse a page with links to articles whose important content looks

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.