嗨,我正在使用Gdata库,我被困在一个地方,我想从xml节点更新特定数据。以下是我正在尝试更新的代码
-(void)UpdateTheXMLNode { NSArray *docdirpath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *fileLoc = [[docdirpath objectAtIndex:0] stringByAppendingPathComponent:@"SomeXML.xml"]; NSData *xmlData = [NSData dataWithContentsOfFile:fileLoc]; GDataXMLDocument *doc = [[GDataXMLDocument alloc]initWithData:xmlData options:0 error:nil]; NSArray *a = [doc.rootElement elementsForName:@"row"]; NSLog(@"data before = %@",[[[a objectAtIndex:0] childAtIndex:1]stringValue]); [[[a objectAtIndex:0] childAtIndex:1]setStringValue:@"Yahooo"]; [a writeToFile:fileLoc atomically:YES]; NSLog(@"data after = %@",[[[a objectAtIndex:0] childAtIndex:1]stringValue]); }
但是它现在给我任何结果所以请帮助我。