开发者

How to get CDATA content into UIWebView in iPhone SDK?

I am n开发者_开发知识库ot understanding how to get the content of CDATA, I

NSString* htmlString = [self getnerateFormattedString:details]; 
[webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.myWebsite.com"]];


-(NSString*) getnerateFormattedString:(TrackDetails*) details
{
    NSString* htmlString = @"";
    htmlString = @"<html><head><title><style type=\"text/css\">a {color: red}</style>";
    htmlString = [htmlString stringByAppendingString:@"</title></head><body style='background-color: transparent;'> "];

if (atrackDetails.trackTitle != nil)
{
    htmlString = [htmlString stringByAppendingString:@"<div align='center' >"];
    htmlString = [htmlString stringByAppendingString:@"<font size='4'>"];
    htmlString = [htmlString stringByAppendingString:details.trackTitle];
    htmlString = [htmlString stringByAppendingString:@"</b></font></div><br>"];
}
htmlString = [htmlString stringByAppendingString:@"<table width=300px cellpadding=5 cellspacing=5 border=0 align='center' height=10px> "];

Like this I am loading using loadHTMLString. But I don't know how to get CDATA Content to load webView.

Please Help Me, Thank you, Madan Mohan.


you have cdata code with html content

When you parse the Xml like this, shown below,

dataString =[dataString stringByAppendingString:@""];

dataString=[dataString stringByAppendingString:@"cdata code with html content for example"

dataString =[dataString stringByAppendingString:@""];

You will get this --> Only Html code that u can pass to method which it can dispaly in webview. Pass this string to loadHTMLString method in webView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜