I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml.
Thanks to all
I want to get distance text from following link. i have used NSXML parsing but unable to get the result. please tell me which xml method should i used for following xml.
Thanks to all
Well the best is usually with the DOM, something like this:
var dist_element = document.getElementsByTagName("distance").child[1];
The thing there is, if you have several elements with the tag distance, you'll get an array. So you will need to iterate over every element.
Sorry I don't go over all the details, but exact implementation depends on your language of choice. Which language are you using?
i think use TouchXML for parsing...bellow link have answer for this
and also you can get subnode with its one example is bellow...
NSArray *nodes3 = [doc nodesForXPath:@"//step" error:nil];
// NSLog(@">>>>>>>>>>>> response node count :%d", [nodes3 count]);
for (CXMLElement *node in nodes3) {
NSString *str;
for(int counter = 0; counter < [node childCount]; counter++) {
// NSLog(@">>>>>>>>> child node name :%@", [[node childAtIndex:counter] name]);
if ([[[node childAtIndex:counter] name] isEqualToString:@"distance"]) {
str = [[node childAtIndex:counter] stringValue];
// NSLog(@"error number :%@", str);
}
//etc....
}
}
hope, this help you.. :)