Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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 使用换行符从XML解码HTML_Iphone_New Operator_Line_Decoding - Fatal编程技术网

Iphone 使用换行符从XML解码HTML

Iphone 使用换行符从XML解码HTML,iphone,new-operator,line,decoding,Iphone,New Operator,Line,Decoding,首先,我解析XML并检索以下内容: &#60;p&#62;&#60;strong&#62;Berns Salonger &#45; the City&#39;s <p><strong>Berns Salonger - the City's Ideal Meeting Place 我使用MWFeedParser(StringByDecodingHtmlenties)对其进行解码并检索: &#60;p&#6

首先,我解析XML并检索以下内容:

&#60;p&#62;&#60;strong&#62;Berns Salonger &#45; the City&#39;s
<p><strong>Berns Salonger - the City's Ideal Meeting Place 
我使用MWFeedParser(StringByDecodingHtmlenties)对其进行解码并检索:

&#60;p&#62;&#60;strong&#62;Berns Salonger &#45; the City&#39;s
<p><strong>Berns Salonger - the City's Ideal Meeting Place 
伯尔尼萨洛格-这座城市理想的聚会场所
请注意,这只是包含大量标签的许多行中的一行

然后我将
替换为\n,控制台将用新行写出文本。一切都很好,除了所有其他HTML标记仍然存在

然后我运行StringByConvertingHTML纯文本和所有HTML标记也替换了我的新行


我如何解码HTML而不同时替换
以在UITextView中打印出格式良好的文本?

与其将

替换为
\n
,不如尝试将其替换为换行符的HTML实体:
&10。然后,当您调用
stringbyconvertingtmltoplantext
时,它会将实体转换为实际的换行符。

如果要替换和?我找不到它的HTML实体。我以为是¶;但事实并非如此。我尝试了:contentText=[contentText stringByReplacingOccurrencesOfString:@““with string:@”和#60;p>;];contentText=[contentText-StringByReplacingOfString:@“

”和字符串:@“<;/;p>;”;但这也不起作用。对: 使用相同的实体;也许可以用两个来增加间距。