I'm trying yo read some specific data from an XML by the use of a IF sentence, it doesn't seem to work though. My code:
tipo=(x[i].getElementsByTagName("tipo")[0].childNodes[0].nodeValue);
subcategoria=(x[i].getElementsByTagName("subcategoria")[0].childNodes[0].nodeValue);
if (tipo=="comer" && subcategoria=="bodegas") {
Bodegas.push(x[i].getElementsByTagName("nombre")[0].childNodes[0].nodeValue)
};
I've been debuging via alerts, and I can tell that tipo & subcategoria values are "comer" and "bodegas" for sure, but when I put an alert inside the if sentence it doesn't run, so I guess the comparison is not properly done. Any ideas? Thanks!!
(tipo == "comer" ? "YES" : "NO")and(subcategoria == "bodegas" ? "YES" : "NO")to see if it's both of the variables that are going wrong?comer*[SPACE]*or*[SPACE]*comeretc? There isn't any spaces or something? Try to usealert("'" + tipo + "'");and see if there's anything between the'that shouldn't be there.