views:

194

answers:

1

Hi, I am facing a problem while XML parsing. I have an NSMutablestring currentElementValue that has newlines into it. It has been received as an XMl from a web source. Even when i am trying to remove newline charactersets of substring the first 3 char there is no effect on the string.

What can be done here? Regards

PC

Code is

  • (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

    if(!currentElementValue) currentElementValue = [[NSMutableString alloc] initWithString:string]; else { [currentElementValue substringFromIndex:3]; [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    NSLog(@"Processing Value : %@ with length %d", currentElementValue,[currentElementValue length] );

}

A: 

The method stringByTrimmingCharactersInSet: remove characters from the beginning and end of string only. The substring call in the previous line doesn't change anything.

Paul Lynch