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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:40:39+00:00 2026-05-26T18:40:39+00:00

I am doing xml parsing while my url is authenticate url with username and

  • 0

I am doing xml parsing while my url is authenticate url with username and password.

When I put this url into a browser it asks me for username and password for login.

I want to parse this url in iphone using NSXMLParser.

For parsing, I’m using the below code but for me it is giving back a parseErrorOccurred error.

NSString *UploadCardDesign=kLOGIN_URL;
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:UploadCardDesign]] autorelease];

[request setHTTPMethod: @"GET"];
[request setHTTPBody:nil]; 

NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
//NSString *strRequ=[[NSString alloc] initWithData:returnData encoding:nsen]
NSString *data=[[NSString alloc]initWithData:returnData encoding:NSUTF8StringEncoding];

And for parsing:

xmlParser = [[NSXMLParser alloc] initWithData:returnData];
[xmlParser setDelegate:self];
[xmlParser parse];

Please help me out for the same or advise what i do for good results.

  • 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-26T18:40:39+00:00Added an answer on May 26, 2026 at 6:40 pm

    Implement this delegate function for authentication….

    - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
     if ([challenge previousFailureCount] == 0)
     {
      NSLog(@"received authentication challenge");
    
      NSURLCredential *newCredential;
      newCredential=[NSURLCredential credentialWithUser:@"root"
                 password:@"rootpassword"
                 persistence:NSURLCredentialPersistenceForSession];
    
    
      NSLog(@"credential created");
    
      [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
    
      NSLog(@"responded to authentication challenge");
    
     }
     else
     {
      NSLog(@"previous authentication failure");
    
      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Authentication Failure" 
                  message:@"Website did not accept the username and password."
                    delegate:nil
                 cancelButtonTitle:@"OK" 
                 otherButtonTitles:nil];
      [alert show];
      [alert release];
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty doing this seemingly simple task. I want to load XML files
I am doing an automatic mapping from XML to NSObject while parsing if the
EveryOne I am doing xml parsing like This public class XMLHandler extends DefaultHandler{ //
I will be doing an occiasional import from XML into core data. I have
I've been doing this all the time: result = subprocess.call(['copy', '123*.xml', 'out_folder\\.', '/y']) if
At work I am parsing large XML files using the DefaultHandler class. Doing that,
Does anyone know why this is happening? I'm doing basic indexing + SAX parsing
I have been doing some XML parsing in my application. I used the following
I am doing xml parsing and it is working fine as i have printed
I'm writing a Java GUI application that is doing some XML parsing and analysis.

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.