I'm trying to find a solution for creating a XML Document and put it in a String, I did some research on how to create generate or write xml in swift, but I found only libraries and I don't want to use them, is there a solution?
I have some UITextFields
, the user put values, when they click on a button, I want to create a xml document.
For exemple: User put his name and age, when they validate I want to have this in a string:
"<?xml version='1.0' encoding='UTF-8'?><name>Ben</name><age>18</age>"
Code:
@IBOutlet var tfNom: UITextField!
@IBOutlet var tfPrenom: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.barTintColor = UIColor(red: 38.0/255.0, green: 51.0/255.0, blue: 85.0/255.0, alpha: 1.0)
self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "Gotham", size: 13)!, NSForegroundColorAttributeName : UIColor.whiteColor()]
self.title = "DEMANDE GRATUITE"
}
@IBAction func Valider(sender: AnyObject) {
verifComplet()
//HERE I WANT TO GET tfNom.text and tfPrenom.text AND PUT THEM INTO A XML DOCUMENT IN A STRING
}