NSXMLParser can not get the content of elements correctly

afsc

New Member
i have the following XMLParser but when i try to run it, it doesn't work properly.\[code\]- (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementname namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict{ if ([elementname isEqualToString:@"results"]) { currentJob = [SearchResult alloc]; }}- (void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementname namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if ([elementname isEqualToString:@"jobTitle"]) { currentJob.jobTitle = currentNodeContent; } if ([elementname isEqualToString:@"location"]) { currentJob.shortAddress = currentNodeContent; } if ([elementname isEqualToString:@"companyName"]) { currentJob.employer = currentNodeContent; } if ([elementname isEqualToString:@"results"]) { [self.jobs addObject:currentJob]; currentJob = nil; currentNodeContent = nil; }}\[/code\]The output doesn't start from the beginning, it starts from the middle of the String...I just can not understand, why some results look nice where some others don't.What am i doing wrong ? How can i parse an xml properly ?Any help will be appreciated.Thx in advance
 
Back
Top