hello all, I'm parsing an xml file and i've been trying to strip out the whitespace characters in my currentElementValue because it's messing up a couple of things.
I can see in my output window that a couple of carriage returns and tabs are present
(gdb) po string
Keep the arms on the side, and lift your leg.
(gdb) po currentElementValue
Keep the arms on the side, and lift your leg.
(gdb)
This is my foundCharacters function and I've been trying to use stringByTrimmingCharactersInSet unfortunately with no success.
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
if(!currentElementValue)
currentElementValue = [[NSMutableString alloc] initWithString:string];
else
{
[currentElementValue appendString:string];
currentElementValue = [currentElementValue stringByTrimmingCharactersInSet:
[NSCharacterSet newlineCharacterSet]];
NSString *instructions = @"instructions";
[directions setValue:string forKey:instructions]; //mm
[appDelegate.directions setValue:string forKey:instructions];
//[appDelegate.directions setObject:string forKey:currentElementValue];
// [appDelegate
}
}
I've been getting this error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to mutate immutable object with appendString:' Which is strange since my currentElementValue is a NSMutableString .. So what's going wrong ? Does anyone have a clue or idea ?