:: Forum >>

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
Tuesday, August 12, 2008
In firefox you should use document.evaluate instead of selectNodes -

http://developer.mozilla.org/en/docs/DOM:document.evaluate
Alex (ActiveWidgets)
Friday, August 15, 2008
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
Wednesday, August 20, 2008

This topic is archived.


Back to support forum

Forum search