views:

292

answers:

1

I've looked all over the web but just can't figure out how to get the text from a node in objective-c. I'm using touchxml and am getting my node list but U I want the title text from a node but instead get a node object. My code is:

resultNodes = [xmlParser nodesForXPath:@"SearchResults/SearchResult" error:&err];

for (CXMLElement *resultElement in resultNodes) {
        
NSString *value = [resultElement elementsForName:@"Title"];
}

If I log the value to the console I get:

<CXMLElement 0x3994b10 [0x39732a0] Title <Title HtmlEncoded="true">test question</Title>>

I want the text, i.e 'test question' instead. I am banging my head against a brick wall here, thanks.

A: 

Try NSString *value = [[resultElement elementsForName:@"Title"] getStringValue];

Smallpawn