Note that there are some explanatory texts on larger screens.

plurals
  1. PONSXMLParser didEndElement and didStartElement been called multiple times
    text
    copied!<p>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).</p> <p>Here are the methods</p> <pre><code>-(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; } } </code></pre> <p>Here is what i am parsing</p> <pre><code>HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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/"&gt; &lt;soap:Body&gt; &lt;authorizePassengerByEmailResponse xmlns="http://tempuri.org/"&gt; &lt;authorizePassengerByEmailResult&gt;string&lt;/authorizePassengerByEmailResult&gt; &lt;/authorizePassengerByEmailResponse&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>Here string inside will either be a name like "FirstName LastName" or "Not Authorized".</p> <p>Any suggestions on why this is happening?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload