function Chkjson (Strjson) {//To determine if the JSON format is correct
if (Strjson = = NULL | | strjson = = "")
return true;
try {
Json.parse (Strjson);
return true;
}
catch (ex) {
return false;
}
}
function Validatexml (strxml, msg) {
Debugger
msg = msg + "\r\r error message: \ r";
Code for IE
if (window. ActiveXObject) {
var xmldoc = new ActiveXObject ("Microsoft.XMLDOM");
Xmldoc.async = "false";
Xmldoc.loadxml (document.all (TXT). value);
//if (XmlDoc.parseError.errorCode! = 0) {
//txt = "Error Code:" + xmlDoc.parseError.errorCode + "\ n";
TXT = txt + "Error Reason:" + XmlDoc.parseError.reason;
//txt = txt + "Error line:" + xmlDoc.parseError.line;
//alert (msg + txt);
//return false;
//} else {
////alert ("No error Found");
//return true;
//}
//}
//code for Mozilla, Firefox, Opera, Chrome, etc.
//Else
if (document.implementation.createDocument) {
var parser = new Domparser ();
//var te XT = TXT;
var xmldoc = parser.parsefromstring (strxml, "text/xml");
if (XmlDoc.documentElement.nodeName = = "ParserError") {
Alert (msg + xmldoc.documentelement.childnodes[0]. NodeValue);
return false;
} else {
//alert ("No Errors Found");
return true;
}
}
////code for IE
else if (window. ActiveXObject) {
Alert (' Please use Chrome browser ');
return false;
}
Else {
Alert (' Your browser cannot process XML validation ');
return false;
}
}