问题
I don't know how can I create XML document using GDataXML nor I could find any good link which can help me.Please tell me how can I perform this or give some good link.
回答1:
Take look at http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml tutorial. It will help you.
回答2:
First create and store the xml value to a string. Then use the following method to create the xml file in the document directory.
//Method writes a string to a xml file
-(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];
}
来源:https://stackoverflow.com/questions/13283840/creating-xml-documents-with-gdataxml