My issue is to display file coming from a XML Response on the iPhone using UIDocumentInteraction Controller. I am unable to convert this file.The guy who is doing web-service is saying that its a binary data. Please refer to the following XML Response
< NewDataSet>
< Table diffgr:id="Table1" msdata:rowOrder="0">
< FILE >
UEsDBBQABgAIAAAAIQDd/JU3ZgEAACAFAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAA < /FILE >
< FILENAME >New Word Doucment < / FILENAME >
< FILETYPE >doc< /FILETYPE >
< RESULT>SUCCESS< /RESULT >
< /Table >
< /NewDataSet >
I have trimmed the FILE tag.. it will be really very huge
I have parsed the xml and stored the content of < FILE > tag into "filePath" I am doing the followingconst char *utfString = [filePath UTF8String];
//filepath contains the string for FILE
NSData *myData = [NSData dataWithBytes: utfString length: strlen(utfString)];
//NSData *myData = [Base64 decode:filePath];
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
//
NSString *file = [NSString stringWithFormat:@"%@.%@", fileName,fileType];
NSString *newPath = [docDir stringByAppendingPathComponent:file];
[myData writeToFile:newPath atomically:YES];
myData=nil;
Please let me know how to parse this XML and save the file or just display it.