- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
This method might not get a whole value - it could be called several times with bits of the content. So, you should have an NSMutableString
as a property on your class and append string
to it each time it's called. Then use that (and then empty the string) in parser:didEndElement:namespaceURI:qualifiedName:
.
Along the same lines, don't save tagName
and try to work in parser:foundCharacters:
, do most of your work in parser:didEndElement:namespaceURI:qualifiedName:
using the element name passed in and the characters that you found and added to your mutable string.
Your log shows that you always have the same instance <MemberDetails: 0x9533320>
and that the information you add to it keeps getting overwritten or is just rubbish. I suspect this is to do with the tag you're using, but you haven't shown sample XML so that's hard to judge. It's quite possibly also to do with the fact that most of your processing is in the parser:foundCharacters:
method.