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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:06:43+00:00 2026-05-26T21:06:43+00:00

i am using NSXMLParser to parse xml data received from a web service in

  • 0

i am using NSXMLParser to parse xml data received from a web service in an app for iPad. My problem is didEndElement and didStartElement are been called multiple times (4 times to be precise).

Here are the methods

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

    NSLog(@"did start element");
    if( [elementName isEqualToString:@"WebServiceResult"])
    {

        if (!soapResults)
        {
             //NSLog(@"did start Element");
            soapResults = [[NSMutableString alloc] init];
        }
        elementFound = YES;
    }
}


-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
    NSLog(@"did end element");

    if ([elementName isEqualToString:@"WebServiceResult"])
    {
        NSLog(@"Soap Results: %@", soapResults);
        [soapResults setString:@""];
        elementFound = FALSE; 
    }
}

Here is what i am parsing

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <authorizePassengerByEmailResponse xmlns="http://tempuri.org/">
      <authorizePassengerByEmailResult>string</authorizePassengerByEmailResult>
    </authorizePassengerByEmailResponse>
  </soap:Body>
</soap:Envelope>

Here string inside will either be a name like “FirstName LastName” or “Not Authorized”.

Any suggestions on why this is happening?

  • 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-26T21:06:43+00:00Added an answer on May 26, 2026 at 9:06 pm

    It is correct behaviour. Look, you have 4 tags:

    1. <soap:Envelope...
    2. <soap:Body>
    3. <authorizePassengerByEmailResponse xmlns="http://tempuri.org/">
    4. <authorizePassengerByEmailResult>

    So each time parser saw the open tag it calls didStartElement.

    You will receive following stack of calls:

    • didStartElement : “soap”
    • didStartElement : “soap”
    • didStartElement : “authorizePassengerByEmailResponse”
    • didStartElement : “authorizePassengerByEmailResult”
    • didEndElement : “authorizePassengerByEmailResult”
    • didEndElement : “authorizePassengerByEmailResponse”
    • didEndElement : “soap”
    • didEndElement : “soap”
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse data from a xml web service but I am
Hello all I'm using NSXMLParser to parse some xml data. I'm using this data
I am using NSXMLParser to parse some xml data. I am using some delegate
I syncing the data on my website to my app, I'm using NSXMLParser to
I am currently using NSXMLParser mathods to parse my data something like this :
I am using NSXMLParser to parse this XML: http://itunes.apple.com/gb/rss/topsongs/limit=50/explicit=true/xml . I am trying to
I'm using NSXMLParser to parse a small XML file containing information about videos. One
I can parse an XML file using NSXMLParser . I can also get the
I am trying to parse a xml document using NSXMLParser. Every time it result
When i try to parse an xml using nsxmlparser, this error code is showing

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.