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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:32:14+00:00 2026-06-05T10:32:14+00:00

This the part of HTML from which I am trying to retrieve an image.

  • 0

This the part of HTML from which I am trying to retrieve an image.

div class="image">
              <a href="http://www.web.com/EN/105/News/10228/"><img src="/images/cache/360x295/crop/images%7Ccms-image-000007796.jpg" width="360" height="295" alt=" (photo: )" /></a>
                         </div>

I can separately get “href” and “img src” values but none of them are the link that would let me reach the image. The valid link would be http://www.web.com plus img src value. I thought to append the string: http://www.web.com to img src but couldn’t figure out how to do it and not sure that this is the right approach. So, what I am trying to get is http://www.web.com/images/cache/360x295/crop/images%7Ccms-image-000007796.jpg

This is my code through which I am parsing the HTML data:

-(void) fethchData

{
    NSError *error = nil;
    NSURL *url=[[NSURL alloc] initWithString:@"http://www.web.com/"];
    NSString *strin=[[NSString alloc] initWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];

    HTMLParser *parser = [[HTMLParser alloc] initWithString:strin error:&error];

    if (error) {
        NSLog(@"Error: %@", error);
        return;
    }

HTMLNode *bodyNode = [parser body];

NSArray *imageNodes = [bodyNode findChildTags:@"div"];

    for (HTMLNode *imageNode in imageNodes) {
        if ([[imageNode getAttributeNamed:@"class"] isEqualToString:@"image"]) {
            HTMLNode *aNode = [imageNode firstChild];
            HTMLNode *imgNode = [aNode nextSibling];
            HTMLNode *imNode = [imgNode firstChild];
             NSURL* imageURL = [NSURL URLWithString:[imNode getAttributeNamed:@"src"] relativeToURL:url];
        NSLog(@"%@", imageURL);

        } 
    }



}

This is the output: /images/cache/360x295/crop/images%7Ccms-image-000007653.jpg -- http://www.web.ge/

I need to see http://www.web.ge/ first and then the rest.

  • 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-05T10:32:16+00:00Added an answer on June 5, 2026 at 10:32 am

    Use:

    NSURL* imageURL = [NSURL URLWithString:[imNode getAttributeNamed:@"src"] relativeToURL:theURLFromWhichYouDownloadedThisHTML];
    

    Update: if you feel you must have an absolute URL object, you could follow the above with:

    imageURL = [imageURL absoluteURL];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code to send mail with php http://www.siteduzero.com/tutoriel-3-35146-e-mail-envoyer-un-e-mail-en-php.html#ss_part_4 . This code
I have read this in order to compile NH spatial for Nhibernate 3.1 http://build-failed.blogspot.it/2012/02/nhibernate-spatial-part-2.html
this is a two part question from a JS newbie. So, I was trying
This is part of my spark partial view (it is called TaskSearch): ${ Html.DropDownList(Search.Status,
my problem is the following: This is a part of my HTML-Code: <form method='GET'
I have Javascript function defined in the main index.html file. One part of this
Considering this part of a Java class, private List<Object> components = new ArrayList<Object>(); private
I'm trying to get a regex which is able to find the following part
i am trying to change image in the div if the user click on
This is kind of a two part question. Is it possible to retrieve data

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.