【问题标题】:Creating XML Documents with GDataXML使用 GDataXML 创建 XML 文档
【发布时间】:2012-11-08 06:41:41
【问题描述】:

我不知道如何使用 GDataXML 创建 XML 文档,也找不到任何可以帮助我的好链接。请告诉我如何执行此操作或提供一些好的链接。

【问题讨论】:

    标签: iphone objective-c ios xml ios5


    【解决方案1】:
    【解决方案2】:

    首先创建 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 值并将其存储到字符串”实现这部分。我是 XML 新手。
    • @subham:更多信息请查看raywenderlich.com/725/…
    • @subham: NSString *str = @" Midhun ";使用 nsstring 的简单 xml
    • @MidhunMP 在 raywenderlich 的示例中我应该在哪里写这段代码?
    猜你喜欢
    • 1970-01-01
    • 2013-04-24
    • 2021-05-09
    • 1970-01-01
    • 1970-01-01
    • 2017-10-24
    • 1970-01-01
    • 1970-01-01
    • 2012-07-14
    相关资源
    最近更新 更多