GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithXMLString:myXMLString options:0 error:&xmlParseError];
NSInteger XPathCount = [[doc nodesForXPath:@"//entry/title" error:nil] count];
NSInteger elementsForNameCount = [[doc.rootElement elementsForName:@"title"] count];
NSLog(@"XPath count: %i", XPathCount );
NSLog(@"elementsForName count: %i", elementsForNameCount );
The result is the XPathCount returns 0 and elementsForNameCount returns 1 despite the fact that they should BOTH be 1, since they're pointing to the same thing. Just to make sure, I've doubled checked the name of the root element with doc.rootElement.name and it is indeed "entry". Why is nodesForXPath not detecting the element like it should?
There's something wrong with my XML string...I tried a different XML string and it worked fine. I'll have to investigate further.
On Sunday, July 15, 2012 2:17:36 AM UTC-5, Zak wrote:Here's my code:GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithXMLString:myXMLString options:0 error:&xmlParseError];
NSInteger XPathCount = [[doc nodesForXPath:@"//entry/title" error:nil] count];
NSInteger elementsForNameCount = [[doc.rootElement elementsForName:@"title"] count];
NSLog(@"XPath count: %i", XPathCount );
NSLog(@"elementsForName count: %i", elementsForNameCount );
The result is the XPathCount returns 0 and elementsForNameCount returns 1 despite the fact that they should BOTH be 1, since they're pointing to the same thing. Just to make sure, I've doubled checked the name of the root element with doc.rootElement.name and it is indeed "entry". Why is nodesForXPath not detecting the element like it should?
--To view this discussion on the web visit https://groups.google.com/d/msg/gdata-objectivec-client/-/Wv7n_YqpDtIJ.
You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com.
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=en.