Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 转换HTML字符串_Iphone_Html - Fatal编程技术网

Iphone 转换HTML字符串

Iphone 转换HTML字符串,iphone,html,Iphone,Html,这可能是一个简单的问题,但我无法从下面的字符串中获得确切的数据。 下面的数据我想提取,但我无法做到这一点。 1.描述 2.当文本 3.何处文本 4.单击此处链接 如何在目标C中转换此值 <p> <a href="http://feedads.g.doubleclick.net/~a/uD33rOAaHkAZywKvO6ntrkv_ETU/0/da"> <img src="http://feedads.g.doubleclick.net/~a/

这可能是一个简单的问题,但我无法从下面的字符串中获得确切的数据。 下面的数据我想提取,但我无法做到这一点。 1.描述 2.当文本 3.何处文本 4.单击此处链接

如何在目标C中转换此值

<p>
    <a href="http://feedads.g.doubleclick.net/~a/uD33rOAaHkAZywKvO6ntrkv_ETU/0/da">
        <img src="http://feedads.g.doubleclick.net/~a/uD33rOAaHkAZywKvO6ntrkv_ETU/0/di" border="0" ismap="true"></img>
    </a>
<br/>
    <a href="http://feedads.g.doubleclick.net/~a/uD33rOAaHkAZywKvO6ntrkv_ETU/1/da">
        <img src="http://feedads.g.doubleclick.net/~a/uD33rOAaHkAZywKvO6ntrkv_ETU/1/di" border="0" ismap="true"></img>
    </a>
</p>


<p>
    <a href="http://mumbai.burrp.com/events/little-theatre-ncpa_semshook_nariman-point_mumbai/19313517316">
        <img src="/images/evt/c/6/photo_little-theatre-ncpa_nariman-point_mumbai@c6s6kwyg_2wat_1_300.jpg"/>
    </a>
</p>                


<p>
    Tenzin is a Tibetan born and raised in India. Yearning to explore his true homeland, he impulsively hops on his motorcycle and embarks on a personal quest: to find his identity and discover the indescribable beauty and wonders of his magnificent homeland. But Tibet is a nation under siege from a repressive regime. While Tenzin encounters friendship, camaraderie and even love along the way, he cannot escape the horrors of a political world he wants no part of. Looking only for the way to peace, both within himself and for the land he loves, Tenzin must find the courage to pursue the truth, even if it means facing terrible dangers to find his Semshook.
<strong>Language</strong>: Hindi, English, Tibetan Film with English subtitles
<strong>Directed by</strong>: Siddharth Anand Kumar
<strong>Cast</strong>: Tenzin Younden, Tenzin Choedon and Tensin Woebhum
</p>

<p>
    <strong>When:</strong> Friday Feb, 24
</p>    

<p>
    <strong>Where:</strong> Little Theatre (NCPA), Nariman Poin
</p>

<p>
    <a href="http://mumbai.burrp.com/events/index.html">More events</a> in Mumbai
</p>

<p>
    <a href="http://mumbai.burrp.com/events/date/this-weekend">Click Here</a> to view more events happening <strong>this weekend</strong> in Mumbai
</p>


Tenzin是在印度出生和长大的藏族人。渴望探索自己真正的家园,他冲动地跳上摩托车,开始了个人探索:寻找自己的身份,发现自己壮丽家园的难以形容的美丽和奇迹。但西藏是一个被专制政权围困的国家。虽然滕津一路上遇到了友谊、同志情谊甚至爱情,但他无法逃脱他不想参与的政治世界的恐怖。只要寻找通往和平的道路,无论是在他自己的内心,还是在他所热爱的土地上,滕津必须找到追求真理的勇气,即使这意味着要面对可怕的危险才能找到他的灵魂。 语言:印地语、英语、藏语电影,配有英文字幕 导演:悉达特·阿南德·库马尔 演员阵容:Tenzin Younden、Tenzin Choedon和Tensin Woebhum

时间:2月24日星期五

地点:小剧场(NCPA),纳里曼·庞

在孟买

查看本周末在孟买发生的更多事件

我用过这段代码,但这给了我纯文本,我想链接相关的文本意味着像文本和链接的组合

NSScanner *theScanner;
    NSString *text = nil;
    theScanner = [NSScanner scannerWithString:html];

    while ([theScanner isAtEnd] == NO) {

        [theScanner scanUpToString:@"<" intoString:NULL] ; 

        [theScanner scanUpToString:@">" intoString:&text] ;

        html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>", text] withString:@""];
    }
    //
    html = [html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    NSLog(@"html======================>%@",html);
    return html;
NSScanner*扫描仪;
NSString*text=nil;
扫描仪=[NSScanner SCANNER WITHSTRING:html];
while([扫描仪显示]==否){
[扫描程序扫描字符串:@“intoString:&text];
html=[html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@“%@>”,text]with string:@“”;
}
//
html=[html stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@“html============================>%@),html);
返回html;

结合使用XML解析和NSString方法