XML文本转义
This commit is contained in:
parent
cf336781d8
commit
3abcfe90bc
|
@ -46,8 +46,24 @@
|
|||
/**
|
||||
* 加载xml数据
|
||||
*/
|
||||
function htmlEscape(str){
|
||||
var s = "";
|
||||
if(str.length == 0) return "";
|
||||
s = str.replace(/&/g,"&");
|
||||
s = str.replace(/&/g,"&");
|
||||
s = s.replace(/</g,"<");
|
||||
s = s.replace(/>/g,">");
|
||||
s = s.replace(/ /g," ");
|
||||
s = s.replace(/'/g,"\'");
|
||||
s = s.replace(/"/g,"\"");
|
||||
s = s.replace(/<script.*?>.*?<\/script>/ig, '');
|
||||
s = s.replace(/<script/gi, "<script ");
|
||||
s = s.replace(/<iframe/gi, "<iframe ");
|
||||
return s;
|
||||
}
|
||||
function loadXmlData() {
|
||||
var textData = Base64.decode($("#textData").val())
|
||||
textData = htmlEscape(textData);
|
||||
window.textPreData = "<xmp style='background-color: #FFFFFF;overflow-y: scroll;border:none'>" + textData + "</xmp>";
|
||||
var xmlNode = xmlTreeViewer.parseXML(textData);
|
||||
window.retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
|
||||
|
|
Loading…
Reference in New Issue