开发者

Problem with one node using Touch XML

开发者 https://www.devze.com 2023-02-13 18:53 出处:网络
How to parse only one node with Touch XML <Link> http://rss.cnn.com/rss/cnn_topstories.rss</Link>

How to parse only one node with Touch XML

<Link> http://rss.cnn.com/rss/cnn_topstories.rss</Link>

http://rssreader.web44.net/rsslink.xml

My ObjC code

CXML开发者_如何学编程Document *rssParser = [[[CXMLDocument alloc] initWithContentsOfURL:url options:0 error:nil] autorelease];

    // Create a new Array object to be used with the looping of the results from the rssParser
    NSArray *resultNodes = NULL;

    // Set the resultNodes Array to contain an object for every instance of an  node in our RSS feed
    resultNodes = [rssParser nodesForXPath:@"Link" error:nil];


I haven't worked with TouchXML, but I have found the next example:

NSArray *root = [rssParser nodesForXPath:@"//Link"  error:nil]; 
CXMLElement Link = [root objectAtIndex:0];

See if it helps...

EDIT:

Maybe you should use:

NSArray *root = [rssParser nodesForXPath:@"//" error:nil];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号