Creating XML Documents with GDataXML

好久不见. 提交于 2019-12-24 20:45:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!