3.2.0

Firefox 2.0 and XML Problems

Hello,

below is the code that we use to dynamically set the header text from the xml return. It works fine within ie but does not work for mozilla/firefox. Reading through the support forum, I found that we would need to use XMLSerializer? If anyone could assist on how to properly redo this function to work with both ie and firefox, I would appreciate it.

var columnTextXpath = "//result/headers/header";
var model_response = data2.response;

data2.response = function( xml ) {
var hNodes = xml.selectNodes( columnTextXpath );
if (hNodes) {
var h = new Array();
for( i=0; i<hNodes.length; i++ ) {
h.push( hNodes[i].text );
}
obj2.setHeaderText( h );
}
model_response.call( data2, xml );
}

Regards,
Steve
August 12,
In firefox you should use document.evaluate instead of selectNodes -

http://developer.mozilla.org/en/docs/DOM:document.evaluate
Alex (ActiveWidgets)
August 15,
This is how we fixed if anyone is interested

data.response = function( xml ) {
if (window.ActiveXObject)
{
var hNodes = xml.selectNodes( columnTextXpath );
if (hNodes) {
var h = new Array();
for( i=0; i<hNodes.length; i++ ) {
h.push( hNodes[i].text );
}
obj1.setHeaderText( h );
}

}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{

var nodes=xml.getElementsByTagName("header") ;
var h = new Array();
for( i=0; i<nodes.length; i++ ) {

h.push( nodes[i].firstChild.nodeValue );
}
obj1.setHeaderText( h );
}
model_response.call( data, xml );

}
Tom
August 20,

This topic is archived.

See also:


Back to support forum