I am using xslt framework to convert xml to html for iOS project. I am sending the encoded xml to the xslt framework. But the output it gives is not encoded. So when i try to parse the html, i am getting the parser error.
NSString *xml = @"<div>a<b</div>" // not exact this but its similar in encoding
NSData *xmlMem = [xml dataUsingEncoding:NSUTF8StringEncoding];
NSString* styleSheetPath = [[NSBundle mainBundle] pathForResource:fileName ofType:fileExtension];
xmlDocPtr doc, res;
xsltStylesheetPtr sty;
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
sty = xsltParseStylesheetFile((const xmlChar *)[styleSheetPath cStringUsingEncoding: NSUTF8StringEncoding]);
doc = xmlParseMemory([xmlMem bytes], [xmlMem length]);
res = xsltApplyStylesheet(sty, doc, nil);
xmlChar* xmlResultBuffer = nil;
xsltSaveResultToString(&xmlResultBuffer, &length, res, sty);
NSString* resultHTML = [NSString stringWithCString: (char *)xmlResultBuffer encoding:NSUTF8StringEncoding];
NSLog(@"Result: %@", resultHTML);
Result: <div>a<b<div>
The result is not an encoded html. Could anyone help me to fix this issue?