Remove newline character while XML parsing
Posted
by Prashant
on Stack Overflow
See other posts from Stack Overflow
or by Prashant
Published on 2010-05-09T11:54:27Z
Indexed on
2010/05/09
11:58 UTC
Read the original article
Hit count: 181
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] );
}
© Stack Overflow or respective owner