MistakesRInevitable
MistakesRInevitable

Reputation: 3

IPhone App to Create XML Doc and Email it

Im creating an IPad app for an internal process we have in at work.

I need to be able to create an xml file which will be comprised of some values that the user enters into a some fields on a form. Than they click submit and this will than throw up the email form (from the MailComposeViewController) and i want to attach the xml file created to this email that they will send. Is this possible, if so, how?

Thanks in advance

Upvotes: 0

Views: 349

Answers (1)

david van brink
david van brink

Reputation: 3642

Here's a fragment where I send xml map data by email --

MFMailComposeViewController *k = [MFMailComposeViewController alloc];
[k init];
[k setSubject:@"Map Data from iPhone"];
[k setMailComposeDelegate:self];
[k addAttachmentData:attachmentData mimeType:@"text/xml" fileName:@"map.xml"];

[k setMessageBody:body isHTML:NO];

[self->controller presentModalViewController:k animated:YES];

For building the XML... I uh, did it myself. Here's some of my methods

-(void)beginElement:(char *)element;
-(void)addAttribute:(char *)attribute value:(char *)attributeValue;
-(void)addText:(char *)text;
-(void)endElement;

(I'd be happy to send you the whole class if you like, though there's perhaps a more recommended way to build xml :) )

Hope that helps point you in the right direction!

Upvotes: 1

Related Questions