I am creating a project in which I have three UITextFields and one UIButton. Now on text fields I have function that user give input. I define a target-action on button press which needs to save the values of the text fields in an XML file. How do I create an xml file and save all the data in xml file with unique ID?
-(IBAction)Submit:(id)sender{
if([txtPhone.text length] == 0 || [txtPhone.text isEqualToString:@""] && [txtName.text length] == 0 || [txtName.text isEqualToString:@""] && [txtEmail.text length] == 0 || [txtEmail.text isEqualToString:@""] )
{
UIAlertView *info = [[UIAlertView alloc] initWithTitle:@"Info" message: @"Please fill the form." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[info show];
[info release];
}
else {
sixthView=[[SixthView alloc] initWithNibName:@"SixthView" bundle:nil];
[self.navigationController pushViewController:self.sixthView animated:YES];
self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:nil action:nil] autorelease];
}
}
The XSWI project hosts a simple, standalone XML stream writer for iOS implemented in Objective-C.
As such, it can be used for iPhone, iPad and iPod apps.
you could get the source code from github project.
check the SO post for creating an XML request in iPhone.