已取得xml的内容字符串,如何把字符串中的特殊字符转换成相应的实体?
已取得xml的内容字符串,想把它显示在
<p id="View"></p>
var str=GetXmlString();//str中的内容如下:<Nodes> <Node> Hello </Node></Nodes>document.getElementById("View").innerHTML=str;//(不要用innerText,textContext这两个属性)
document.getElementById("View").innerHTML = str.replace(/</g, "<").replace(/>/g, ">");