iPhone SDK: XML mystery, after adding child nodeforXPath returns nothing (found a hacky solution)
I have a big mystery here, I have a Gdataxml document property: GDataXMLDocument *doc; I'm adding a new element to doc, interestingly, this method below looks perfect for other elements but not for the element I just added: GDataXMLElement *newValueDefElement = [GDataXMLNode elementWithName:@"valuedefinition"]; [variableElement addChild:newValueDefElement]; and now when I query: NSString *path = [NSString stringWithFormat:@"//inferenceresponse/state/variable[pageId=%d]/valuedefinition",pageID]; NSArray *valueElement = [self.doc nodesForXPath:path error:nil]; Now array comes with zero objects!