I need help to debug my XML parsing please

Posted by Griffo on Stack Overflow See other posts from Stack Overflow or by Griffo
Published on 2010-04-23T21:59:17Z Indexed on 2010/04/23 22:03 UTC
Read the original article Hit count: 253

Filed under:
|
|
|

I'm parsing this line:

<type>branch</type>

with this code

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

I don't understand where the carriage return is being added, can anyone help?

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about objective-c