Ok, finally I solved this question by myself.
Edit GDataXMLNode.m
to make it pretty-print XML by default
Open GDataXMLNode.m
, and find method – (NSString *)XMLString
Replace: int format = 0
with int format = 1;
then write code like below in Swift:
let document : GDataXMLDocument = GDataXMLDocument(rootElement: rootElement)
let xmlString : String = GDataXMLDocument.prettyPrintXML(NSString(string:document.rootElement().XMLString()) as String)
This is working fine.
solved How do I format XML files in swift?