xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abraham Rodriguez Mota" <abraham.r...@gmail.com>
Subject Comparing strings
Date Mon, 08 Sep 2008 10:27:16 GMT
Hi all,

I am trying to compare two strings but the comparison operator always
returns false. I printed the values using the alert function and the strings
are read properly but the result is always false even when they are equal.
The comparison works when I compare the var values with static strings
-(i.e: currentId=='c1c2'), but not when comparing the two
variables-(currentId==elementID). I have tried to cast the values to strings
and use the localeCompare method but it didn't work.  Any help will be
really appreciated.

function updateConnections(targetElement){
//Reading custom metadata, name space xxx
var relation=targetElement.getElementsByTagNameNS(xxx,'rel');
var elementID;

var currentId=relation.item(0).firstChild.nodeValue;
var updateRelation=relationsGroup.getElementsByTagName('line');


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

//variable's content change
alert(elementID +" " + currentId+ "   ");
//but this is always false
alert(elementID == currentId);

//Here is the problem

elementID=' ';

thanks a lot


View raw message