I'm parsing this line:
<type>branch</type>
with this code in didEndElement
if ([elementName isEqualToString:@"type"]) {
[currentBranchDictionary setValue:currentText forKey:currentElementName];
}
When I test the value in the type
key, it does not contain branch
but instead it contains branch\n
. Here is the test I'm performing:
if ([[currentBranchDictionary valueForKey:@"type"] isEqualToString:@"branch"]) {
NSLog(@"no new-line");
} else if ([[currentBranchDictionary valueForKey:@"type"] isEqualToString:@"branch\n"]) {
NSLog(@"new-line");
}
this returns the "new-line" output
Here's the foundCharacters method:
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
[currentText appendString:string];
}
I don't understand where the carriage return is being added, can anyone help?