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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:22:54+00:00 2026-06-11T12:22:54+00:00

My php response in xml is of this type <users> <username>myemail</username> <password>mypass</password> </users> Now

  • 0

My php response in xml is of this type

<users>
<username>myemail</username>
<password>mypass</password>
 </users>

Now this is my parseUrl class

  NSURL *parserUrl = [[[NSURL alloc] initWithString:urlString] autorelease];
        NSXMLParser *parser = [[[NSXMLParser alloc] initWithContentsOfURL:parserUrl] autorelease];
        [parser setDelegate:self];



- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {



    if ( [elementName isEqualToString:@"users"]) 
    {
        return;
    }



    if ( [elementName isEqualToString:@"username"] ) 
    {
        NSString *val = [attributeDict  objectForKey:@"username"] ;    
      return;
    }

}

Now the problem is, the attributeDict is giving 0 pairs. The function is reading username, password and users meaning it can get inside this loop

   if ( [elementName isEqualToString:@"username"] ) 
        {
            NSString *val = [attributeDict  objectForKey:@"username"] ;    
          return;
        }

But how can i retrieve the value of this node?

  • 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-11T12:22:56+00:00Added an answer on June 11, 2026 at 12:22 pm

    remove return statment

    and attributeDict is alway contain attributes.

    e.g.

    here ‘id’ is attribute of user.

    to getting string value, you need to write

    //take string variable in header file 'elementname'
    
    NSString *elementname;
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
    
    elementname = elementName;
    }
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
    
        elementname = elementName;
    }
    
    
    -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
    
       if([elementname isEqualToString:@"username"])
       {
           NSLog(@"username : %@",string);
       }
       else if([elementname isEqualToString:@"password"])
       {
           NSLog(@"password : %@",string);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to parse this php xml response in android: <?phpxml version=1.0 encoding=utf-8?> <SmsResponse>
How do I convert SOAP response like this to php array using SimpleXML? <?xml
I'm using PHP and since this server response is not pure XML I've been
function getData(d){ Back = new Object(); $.getJSON('../do.php?', function(response){ if(response.type == 'success'){ Back = {
<?php error_reporting(E_ALL); $url = 'saved_report.xml'; define('XML_HEADER', '*RWRESPONSE*RESPONSE*DATA*HEADER*COLUMN'); define('XML_ROW', '*RWRESPONSE*RESPONSE*DATA*ROW*COLUMN'); $headers = array(); $rows =
I have this jquery code: $.ajax({ type: GET, url: http://api.ipinfodb.com/v2/ip_query.php?key=3b80b5588c22d2a03c0e6979d1e85e397e043646c4a65ffe47ff01d47bce51e, dataType: xml, success: function(xml)
page.xml.php will not show any output, in firebug I can see the get response
I have this xml result from calling the page getRout.php <?xml version=1.0 encoding=UTF-8?> <kml
I have the following php code (getRout.php).. which response results in xml formats ...
I have a php page server1.com/page1.php (not real) and another page server2.com/page2.php page1.php response

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.