Response XML Problem

The responseXML functionality is not working in IE. Is there any workaround for the same.

Regards

Sameer

Subject: Response XML Problem

Yes it very much does work in IE 6 and 7. I would look in more detail at your code. responseXML doesn’t work in FireFox unless the header comes back as text/xml.

Subject: RE: Response XML Problem

Hi Adam this is the code written onchange even of a drop down list

var xmlHTTP;

server=window.location.hostname;

//alert(window.opener.document.forms[0].Pathname.value)

db= window.opener.document.forms[0].Pathname.value;

var SelectBy = document.getElementById(“Selectby”);

//alert(SelectBy.options[SelectBy.selectedIndex].text);

//var vals = new Array()

var url = “http://”+server+“/”+db+“/xmlTest?OpenAgent&SelectBy=”+SelectBy.options[SelectBy.selectedIndex].text;

alert(1)

//vals= dbColumn(server,db,“SAPRoles”,1)

alert(2)

alert(url)

try

{

xmlHTTP = new XMLHTTPRequest();

alert(2)

}

catch(e)

{

try

{

xmlHTTP = new ActiveXObject(“Msxml2.HTTP”);

alert(3)

}

catch(e)

{

try

{

xmlHTTP = new ActiveXObject(“Microsoft.XMLHTTP”);

alert(4)

}

catch(e)

{

alert(“Your browser doesnt support ajax”);

return false;

}

}

}

//if(xmlHTTP!=“”)

{

xmlHTTP.onreadystatechange = StateChanged;

alert(4.2)

xmlHTTP.open(“GET”,url,true);

xmlHTTP.setRequestHeader(“Content-Type”, “text/xml”)

alert(4.3)

xmlHTTP.send(null)

alert(4.4)

}

alert(5)

function StateChanged()

{

//alert(5.1)

if(xmlHTTP.readyState==4)

{

alert(6)

var xmlDoc = xmlHTTP.responseXML.documentElement;

alert(xmlHTTP.getResponseHeader(“Content-Type”));

alert(6.1)

if(!xmlDoc)

alert(“XMLDOC IS NOTHING”)

alert("Response XML: "+xmlDoc);

var b = xmlHTTP.responseText;

//alert(b.getElementsByTagName(‘root’)[0].nodeName)

//alert(xmlDoc.getElementsByTagName(‘value’)[0].nodeName)

alert(b);

var body = document.body;

var newEle = document.createElement(‘div’);

newEle.setAttribute(‘id’,‘xml’);

newEle.setAttribute(‘innerHTML’,b);

body.appendChild(newEle)

alert(7)

var xmlDoc = document.getElementById(‘xml’);

alert(8)

if(xmlDoc==null)

{

alert(“xml doc is null”)

}

//alert(xmlDoc.childNodes.length)

alert("Node name of document : "+xmlDoc.nodeName)

alert(“Node Name of first child”+xmlDoc.childNodes[1].nodeName)

//var xmlRootEle = xmlDoc.childNodes;

if(xmlRootEle.hasChildNodes())

{

alert(“has child”);

}

else

{

alert(“Doesnt have any child”);

}

alert(xmlRootEle.childNodes[0].nodeName);

alert(9)

//document.getElementById(“test”).innerHTML=b.getElementsByTagName(“value”)[0].childNodes[0].nodeValue

document.forms[0].test.value = b;

}

}

As well as i have created an agent which contains the following code

Dim s As New notessession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim param As Variant

Set doc = s.DocumentContext

param = Evaluate(|@Middle(Query_String_Decoded;"&SelectBy=";"&")|,doc)

Msgbox "Param value" & param(0)



Dim sapRolesView As NotesView

Dim viewDoc As NotesDocument

Set db = s.CurrentDatabase



Set sapRolesView = db.GetView("SAPRoles")



Set viewDoc = sapRolesView.GetFirstDocument

mstr = "<?xml version'1.0'?><root>"



If param(0)="By Roles Description" Then

	While Not viewDoc Is Nothing

		mstr = mstr+"<val>"+viewDoc.RoleDescription(0)+"</val>"

		Set viewDoc = sapRolesView.GetNextDocument(viewDoc)

	Wend

Elseif param(0)="By Role Name" Then

	While Not viewDoc Is Nothing

		mstr = mstr+"<val>"+viewDoc.Role(0)+"</val>"

		Set viewDoc = sapRolesView.GetNextDocument(viewDoc)

	Wend

End If



mstr = mstr+"</root>"

Print "Content-Type: text/xml"



Print mstr

Kindly request you to help as quick as possible

Regards

Sameer

Subject: RE: Response XML Problem

Do you get something back from responseText but not responseXML? If so the xml you are sending over might not be well-formed and the parser is not able to interpret it.

Cheers

Adam.