In GdataXML I can only use nodesforXpath from the root of XML, but I want that once I have the inferenceMembers I would like to apply Xpath to rest of this node, but not whole DOM tree, is that possible?
Example below works wrong in for loop, brings all the varibles in the DOM, but I want to work only on the variableElement not whole the DOM once I have the variableElement.
NSArray *inferenceMembers = [doc nodesForXPath:@"//inferenceresponse/state/variable[not(valuedefinition/variablevalue)]" error:nil];
for (GDataXMLElement *variableElement in inferenceMembers) {
Variable *variable=[[Variable alloc] init];
NSArray *items = [variableElement nodesForXPath:@"//variable/domaindefinition/domain/enumType/domainitem" error:nil];
}
The reason I want this not because it is hard to do, but I guess it would be slower if I xpath query to whole XML to reach the same element’s children each time. I have read that I can do some magic with namespaces and NSDictionary but do not know how to do
Try this:
It’d be useful to see the XML structure to be able to help fully.