I am reading data from a XML file. I need to test the value of one of the nodes and then use a Swith/Case statement to test the value of one of the nodes. Below is my code:
When I trace tye typeof the tmpCity variable it is string. I've verified that tmpCity is MEM. However, I am entering the default case.
If anyone has any ideas why a trace shows that tmpCity is a string with a value of MEM, yet my case statement isn't working, I would appreciate any help.
Code:
_root.sixthnode = this.firstChild.childNodes[0].childNodes[6].firstChild.nodeValue;
var tmpCity = _root.sixthnode;
trace(typeof(tmpCity)); //outputs string
trace(tmpCity); // outputs MEM
switch(tmpCity)
{
case 'MEM':
tmpCity = 'Memphis';
break;
default:
trace("failure");
}
When I trace tye typeof the tmpCity variable it is string. I've verified that tmpCity is MEM. However, I am entering the default case.
If anyone has any ideas why a trace shows that tmpCity is a string with a value of MEM, yet my case statement isn't working, I would appreciate any help.