当我按照本教程使用 GDataXML 生成 XML 时 http://www.raywenderlich.com/725/xml-tutorial-for-ios-how-to-read-and-write-xml-documents-with-gdataxml 并将其保存到文档文件夹中。 从文档文件夹中打开该文件后,它的 xml 版本 =“1.0”。 我想将 xml 版本更改为 2.0。请提出任何更改版本的建议。
最佳答案
在教程中,你有这个,对吧?
GDataXMLDocument *document = [[[GDataXMLDocument alloc]
initWithRootElement:partyElement] autorelease];
要将 xml 文档的版本从“1.0”更改为“2.0”,您可以这样做:
NSString *versionString = @"2.0";
const unsigned char *cVersionString = (const unsigned char*)[versionString cStringUsingEncoding:NSUTF8StringEncoding];
document.rootElement.XMLNode->doc->version = cVersionString;
关于iphone - 更改 GDataXML 中的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18097770/