XSLT in a UIWebView using iOS SDK 4.2

北慕城南 提交于 2019-11-29 04:42:37

The answer is yes. Here's an example:

NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *xml = @"<?xml version=\"1.0\"?><?xml-stylesheet type=\"text/xsl\" href=\"greeting.xsl\"?><greeting>Hello, World!</greeting>";
[self.webView loadData:[xml dataUsingEncoding:NSUTF8StringEncoding] MIMEType:@"text/xml" textEncodingName:@"utf-8" baseURL:baseURL];

I was having problems with this because I was trying to load XML using the UIWebView's

- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL

method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!