A Return NSString Problem
A Return NSString Problem
- Subject: A Return NSString Problem
- From: Bing Li <email@hidden>
- Date: Mon, 30 May 2011 11:19:50 +0800
Dear all,
I got a problem when processing NSString returned from a method, which
extracting data from an XML. The data is extracted correctly by the
following method.
However, when executing "isEqualToString" with the returned NSString, it got
the exception as follows.
"-[NSXMLNode isEqualToString:]: unrecognized selector sent to instance
0x1001233e0"
If tracking with XCode, the NSString variable which holds the returned value
from the following method is specified as "Variable is not a CFString". How
to fix the bug?
+ (NSString *) Read:(NSString *)xml Path:(NSString *)xPath
{
NSError *err = nil;
NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xml
options:NSXMLDocumentTidyXML error:&err];
NSArray *nodes = [xmlDoc nodesForXPath:xPath error:&err];
[xmlDoc release];
[err release];
if ([nodes count] > 0)
{
return [[nodes objectAtIndex:0] autorelease];
}
else
{
return Constants.WWW.EMPTY_STRING;
}
}
Thanks so much!
Bing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden