The short answer is: No, there is no built-in ability to do this in the Cocoa libraries.
Because you're writing rather than parsing, and presumably dealing with a limited universe of possible tags, the code to output XML is actually not that complicated. It should just be a simple method in your Invoice object, something like:
- (NSString*) postStringInXMLFormat
{
NSMutableString* returnValue = [[NSMutableString alloc] init];
if([self email])
{
[returnValue appendString:@"<email>"];
[returnValue appendString:[self email]];
[returnValue appendString:@"</email>"];
}
if([self invoice_date])
...
and so on. At the end return
[NSString stringWithString:returnValue]
There are plenty of third-party projects out there that try to generalize this process; several of them are listed in this answer:
Xml serialization library for iPhone Apps
But if all you're looking to do is create a single, stable format that your server side will recognize, and you don't have a ridiculous number of entities to convert, it's probably less work to roll your own.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…