使用 iOS SDK 4.2 的 UIWebView 中的 XSLT [英] XSLT in a UIWebView using iOS SDK 4.2

查看:24
本文介绍了使用 iOS SDK 4.2 的 UIWebView 中的 XSLT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在使用 iOS SDK 4.2 的 UIWebView 中使用 XSLT?或者,是否可以在 UIWebView 之外的 iOS SDK 4.2 中使用 XSLT?我见过与此类似的问题,但它们似乎已经过时并参考了 4.0 之前的 iOS SDK.

Is it possible to use XSLT in a UIWebView using iOS SDK 4.2? Alternatively, is it possible to use XSLT in iOS SDK 4.2 outside of a UIWebView? I have seen similar questions to this, but they seem to be dated and refer to pre-4.0 iOS SDKs.

如果可能,一个简单的 iOS XSLT 示例的链接也很棒.

If it is possible, a link to a simple iOS XSLT example would be great too.

TIA.

推荐答案

答案是肯定的.举个例子:

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];

我遇到了这个问题,因为我试图使用 UIWebView 的

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

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

方法.

这篇关于使用 iOS SDK 4.2 的 UIWebView 中的 XSLT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆