用GDataXML创buildXML文档
我不知道如何使用GDataXML创buildXML文档,也没有find任何可以帮助我的好链接。请告诉我如何执行此操作或给出一些好的链接。
看看http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml教程。 它会帮助你。
首先创build并将xml值存储到一个string。 然后使用以下方法在文档目录中创buildxml文件。
//方法将一个string写入一个xml文件
-(void) writeToXMLFile:(NSString *)content { //get the documents directory: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; //make a file name to write the data to using the documents directory: NSString *fileName = [NSString stringWithFormat:@"%@/xmlfile.xml",documentsDirectory]; //save content to the documents directory [content writeToFile:fileName atomically:NO encoding:NSStringEncodingConversionAllowLossy error:nil]; }