0
我不知道如何使用GDataXML創建XML文檔,也無法找到任何可以幫助我的好鏈接。請告訴我如何執行此操作或給出一些良好的鏈接。使用GDataXML創建XML文檔
我不知道如何使用GDataXML創建XML文檔,也無法找到任何可以幫助我的好鏈接。請告訴我如何執行此操作或給出一些良好的鏈接。使用GDataXML創建XML文檔
首先創建xml值並將其存儲爲字符串。 然後使用以下方法在文檔目錄中創建xml文件。
//方法將一個字符串寫入到一個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];
}
我不知道我怎麼能「首先創建和XML值存儲爲一個字符串」實現這個part.I'm新XML 。 –
@subham:請查看http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml瞭解更多 –
@subham:NSString * str = @「<? xml version =「1.0」encoding =「UTF-8」?> Midhun 「;簡單的XML使用nsstring –