如何從解析XML中刪除HTML實體? 意味着我解析XML,但我不能刪除<br/>
,
等分析時解析html屬性
0
A
回答
2
[NSString stringByReplacingOccurrencesOfString:@","withString:@""];
嘗試使用此功能,替換符號巫婆你想要的。
+0
你在做什麼? – 2011-04-28 06:14:07
4
你的意思是這樣的嗎?
/**
* Removes the HTML tags found in the string
* @param html the string to scan
*
* @returns the original string without tags
*/
- (NSString *)flattenHTML:(NSString *)html {
NSScanner *thescanner;
NSString *text = nil;
thescanner = [NSScanner scannerWithString:html];
while ([thescanner isAtEnd] == NO) {
// find start of tag
[thescanner scanUpToString:@"<" intoString:NULL];
// find end of tag
[thescanner scanUpToString:@">" intoString:&text];
// replace the found tag with a space
html = [html stringByReplacingOccurrencesOfString:
[NSString stringWithFormat:@"%@>", text]
withString:@" "];
} // while //
return html;
}
相關問題
- 1. 解析HTML href屬性
- 2. HtmlAgilityPack解析屬性
- 3. 解析類屬性
- 4. XML屬性解析
- 5. 解析JSON屬性
- 6. XPath屬性解析
- 7. 解析屬性NSserialization
- 8. 解析XML屬性
- 9. 解析屬性XML
- 10. NSXMLParser解析屬性
- 11. 解析AndroidManifest屬性
- 12. 解析屬性某些HTML元素
- 13. 解析屬性文件內容爲HTML
- 14. 解析HTML表缺少的屬性
- 15. 使用R或python解析HTML屬性
- 16. Python 3 - HTML解析器 - 空屬性
- 17. 如何解析HTML節點的屬性
- 18. 使用Java解析HTML「樣式」屬性
- 19. iOS使用Hpple解析HTML屬性
- 20. 解析輸入屬性名稱分爲
- 21. UnicodeEncodeError解析HTML時
- 22. 解析XML時出錯:重複屬性?
- 23. 解析XML時,文件有xmlns屬性
- 24. HTML敏捷性解析
- 25. html解析爲DOM性能
- 26. 解析HTML Java中線性
- 27. 使用DOM分析器解析和編輯HTML解析器
- 28. Android解析樣式屬性和屬性?
- 29. 無法解析屬性(複雜屬性)
- 30. AngularJS解析插值屬性
發佈HTML代碼時,請使用反碼(\「
\')來轉義它們,否則它們將不會顯示在您的帖子中。 – nash 2011-04-27 06:52:14