I am trying to load xml file as well as xml as string input, and have written following code. This is working in IE but not in FireFox, can anyone help?
-------------------------------------------------------------------------------------------------------
[CODE=javascript]function MyXML() {
try{
this._xmlDoc=ne w ActiveXObject(" Microsoft.XMLDO M");
this._flag = 1;
}
catch(e)
{
try{
this._xmlDoc=do cument.implemen tation.createDo cumen t("","",null) ;
this._flag = 2;
}catch(e) {alert(e.messag e);}
}
}
MyXML.prototype ._xmlDoc;
MyXML.prototype ._xmlObj;
MyXML.prototype ._firstElementT ext;
MyXML.prototype ._flag;
MyXML.prototype .loadXMLFile = function(xmlFil e)
{
try{
this._xmlDoc.as ync="false";
//this._xmlDoc.on readystatechang e=verify;
this._xmlDoc.lo ad(xmlFile);
this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
return this._xmlDoc;
}
MyXML.prototype .loadXMLString = function(xmlStr ing, document)
{
if(this._flag == 1)
{
try{
this._xmlDoc=ne w ActiveXObject(" Microsoft.XMLDO M");
this._xmlDoc.as ync="false";
this._xmlDoc.lo adXML(xmlString );
this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
}
else if(this._flag == 2)
{
try{
this._xmlDoc=do cument.implemen tation.createDo cumen t("","",null) ;
this._xmlDoc.as ync="false";
var parser=new DOMParser();
this._xmlDoc=pa rser.parseFromS tring(xmlString ,"text/xml");
//this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
}
return this._xmlDoc;
}
[/CODE]
---------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
[CODE=javascript]function MyXML() {
try{
this._xmlDoc=ne w ActiveXObject(" Microsoft.XMLDO M");
this._flag = 1;
}
catch(e)
{
try{
this._xmlDoc=do cument.implemen tation.createDo cumen t("","",null) ;
this._flag = 2;
}catch(e) {alert(e.messag e);}
}
}
MyXML.prototype ._xmlDoc;
MyXML.prototype ._xmlObj;
MyXML.prototype ._firstElementT ext;
MyXML.prototype ._flag;
MyXML.prototype .loadXMLFile = function(xmlFil e)
{
try{
this._xmlDoc.as ync="false";
//this._xmlDoc.on readystatechang e=verify;
this._xmlDoc.lo ad(xmlFile);
this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
return this._xmlDoc;
}
MyXML.prototype .loadXMLString = function(xmlStr ing, document)
{
if(this._flag == 1)
{
try{
this._xmlDoc=ne w ActiveXObject(" Microsoft.XMLDO M");
this._xmlDoc.as ync="false";
this._xmlDoc.lo adXML(xmlString );
this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
}
else if(this._flag == 2)
{
try{
this._xmlDoc=do cument.implemen tation.createDo cumen t("","",null) ;
this._xmlDoc.as ync="false";
var parser=new DOMParser();
this._xmlDoc=pa rser.parseFromS tring(xmlString ,"text/xml");
//this._xmlObj=th is._xmlDoc.docu mentElement;
}catch(e) {alert(e.messag e)}
}
return this._xmlDoc;
}
[/CODE]
---------------------------------------------------------------------------------------------------------------
Comment