特殊的HTML字符(安培;#39; - > QUOT)的XML文件 [英] Spécial HTML character ( & # 39; -> quot ) in XML file
本文介绍了特殊的HTML字符(安培;#39; - > QUOT)的XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了一个&放大器;#39;在我的XML文件中。 (它是CHAR code是HTML格式的QUOT)
I got an " & # 39; " in my XML file. (it is the char code for the quot in HTML)
EX:
<说明>布拉布拉喇嘛的&安培; #39 ;喇嘛喇嘛拉。 < /递减>
< desc > blabla bla & # 39; bla bla la. < / desc>
当我与解析字符串TMP = itemOfEvent.getFirstChild()。getNodeValue()
它把我的文字中庸之道的QUOT之前。
When i parse it with String tmp = itemOfEvent.getFirstChild().getNodeValue()
it cut my text juste before the quot.
我买了 URL.en code(TMP,UTF-8)
更好的主意?
推荐答案
我找到了最好的解决办法是更换坏的字符
The best solution i've found was to replace bad char
xmlString = xmlString.replaceAll(" & #39;", " \ ' ");
这篇关于特殊的HTML字符(安培;#39; - &GT; QUOT)的XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文