Xml

hi alli am having this function for dbcolumn. anyone can please tell me how to use this function? any special declaration will need to use it or i can simply call as

var result=dbColumn(this.form.Server_Name,this.form.DbPath,“viewname”,“columnumber”)

i have tried this (with trim function declared) but got the error as "object doen’t support this property or method "

so will i need to modify it ? please comment.

function dbColumn(server,path,view,column)

{

// server e path optional

xmlDoc = new ActiveXObject("Microsoft.XMLDOM");	

xmlDoc.async = false;



var pos=0;		

currURL = (document.location.href).toLowerCase();	

if (trim(server) == "") 

{

		pos = currURL.indexOf('://'); 

	if (pos < 0 )

		server = "http://abc:82" // PUT YOUR SERVERNAME HERE

	else

	{

		pos += 3;

		pos = currURL.indexOf('/', pos);

		server = currURL.substring(0, pos)

	}

}



if( trim(path) == "" )

{

	if( pos > 0 )

	{

		newPos = currURL.indexOf('.nsf',pos);

		if (newPos > 0)

		{

			path = currURL.substring(pos+1,newPos+4)

		}

	}

}



if( !isNaN(column) )

	column -= 1; 



vurl = trim(server)+"/"+trim(path)+"/"+view+"?readviewentries&login=1&count=9999";

// alert(vurl)

xmlDoc.load(vurl);



nodes = xmlDoc.documentElement.childNodes;

temp = new Array(nodes.length);

var j = 0;

for (var i = 0; i < nodes.length; i++)

{

	temp[j] = nodes.item(i).childNodes.item(column).text;

	j++;

}



results = new Array(j);

for (var i = 0; i < j; i++)

{

	results[i] = temp[i];

}



return(results);

} //End of dbColumn

thanks in advance

Subject: re: javascript error “object doesn’t support this property or method” using Microsoft.XMLDOM object

On what line of the function do you get the error message? What makes you think the error message actually has anything to do with XML, as opposed to, say, string handling before you get to any XML stuff?

What does “with trim function declared” mean?

Please use a more informative subject line.

I don’t understand why you create a new array (results) and copy temp into it, instead of just returning temp, which is the identical array.

Subject: RE: re: javascript error “object doesn’t support this property or method” using Microsoft.XMLDOM object

hiin the mentioned function i get an error

“object doesn’t support this property or method”

at line

xmlDoc.load(vurl);

what may the problem?

And secondly i mentioned with trim function means , i have defined the trim function at the top of the jsheader. so there is no possibility to get an error “object…” because of trim() function.

something else is there. can you guess what may it be?

thanks in advance

Subject: xml

hinow i got the column values by the above function. But now problem is, there is only one column & i got the values as

Left HandRight HandTopBottomNorth DirectionSouthEastWest

like this, even though i have seperated values in the column by new line.

Now how should i split the values by javascript ?

pls suggest any way.

Subject: RE: xml

There is no way that function is returning a single string that contains values from multiple rows, unless you have modified it greatly from what you posted before. It’s returning an array that contains one element from each row.

I suspect the merging together is happening after you call this function, possibly in the alert call you use to display the value. Showing your code would help.