Iphone 使用换行符从XML解码HTML
首先,我解析XML并检索以下内容:Iphone 使用换行符从XML解码HTML,iphone,new-operator,line,decoding,Iphone,New Operator,Line,Decoding,首先,我解析XML并检索以下内容: <p><strong>Berns Salonger - the City's <p><strong>Berns Salonger - the City's Ideal Meeting Place 我使用MWFeedParser(StringByDecodingHtmlenties)对其进行解码并检索: <p
<p><strong>Berns Salonger - the City's
<p><strong>Berns Salonger - the City's Ideal Meeting Place
我使用MWFeedParser(StringByDecodingHtmlenties)对其进行解码并检索:
<p><strong>Berns Salonger - the City'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>;”;但这也不起作用。对:
使用相同的实体;也许可以用两个来增加间距。