I am having problem in parsing a string containing HTML Tags.
The situation is somewhat similar to the following as quoted in some other forum :
if (typeof DOMParser == "undefined" ) {
DOMParser = function () {}
DOMParser.proto type.parseFromS tring = function (str, contentType) {
if (typeof ActiveXObject != "undefined" ) {
var d = new ActiveXObject(" Microsoft.XMLDO M");
d.async="false" ;
d.loadXML(str);
return d;
} else if (typeof XMLHttpRequest != "undefined" ) {
var req = new XMLHttpRequest;
req.open("GET", "data:" + (contentType || "applicatio n/xml") +";charset=u tf-8," + encodeURICompon ent(str), false);
if (req.overrideMi meType) {
req.overrideMim eType(contentTy pe);
}
req.send(null);
return req.responseXML ;
}
}
}
var xml = (new DOMParser()).pa rseFromString(t ext, "text/xml");
in the code of mine similar to the above i am also not getting the parsed value, its coming to be null.
Any suggestions would be appreciated.
thanks
The situation is somewhat similar to the following as quoted in some other forum :
if (typeof DOMParser == "undefined" ) {
DOMParser = function () {}
DOMParser.proto type.parseFromS tring = function (str, contentType) {
if (typeof ActiveXObject != "undefined" ) {
var d = new ActiveXObject(" Microsoft.XMLDO M");
d.async="false" ;
d.loadXML(str);
return d;
} else if (typeof XMLHttpRequest != "undefined" ) {
var req = new XMLHttpRequest;
req.open("GET", "data:" + (contentType || "applicatio n/xml") +";charset=u tf-8," + encodeURICompon ent(str), false);
if (req.overrideMi meType) {
req.overrideMim eType(contentTy pe);
}
req.send(null);
return req.responseXML ;
}
}
}
var xml = (new DOMParser()).pa rseFromString(t ext, "text/xml");
in the code of mine similar to the above i am also not getting the parsed value, its coming to be null.
Any suggestions would be appreciated.
thanks
Comment