Search code examples
iphoneiosxcode4gdataxml

change the version in GDataXML


When I generate the XML using GDataXML by following this tutorial http://www.raywenderlich.com/725/xml-tutorial-for-ios-how-to-read-and-write-xml-documents-with-gdataxml and saved that to documents folder. After opening that file from documents folder, it has xml version = "1.0". I want to change the xml version to 2.0. Please give any suggestions to change the version.


Solution

  • In the tutorial, you have this, right?

    GDataXMLDocument *document = [[[GDataXMLDocument alloc] 
            initWithRootElement:partyElement] autorelease];
    

    To change the version of the xml document from "1.0" to "2.0", you can do this:

    NSString *versionString = @"2.0";
    const unsigned char *cVersionString = (const unsigned char*)[versionString cStringUsingEncoding:NSUTF8StringEncoding];
    document.rootElement.XMLNode->doc->version = cVersionString;