Error: Node '__switch__314' has not been correctly processed

I have the following code (for example) and I’m getting an error before I can run my script.

var journalList : XmlNodeList = XmlDoc.GetElementsByTagName("entry");
		var journalEntries : Array = new Array();
		
		for (N in journalList){

	            var journal : JournalEntry = new JournalEntry();
		    
		    var children = N.ChildNodes;
		    
		    for(var i = 0; i<children.Count;i++){

		    	var childName : String = children[i].Name.ToString();
		    	Debug.Log("childName: "+childName);
				
		    	switch(childName){
			
			   case "id":
		    	     Debug.Log ("ID: ");
		    	     journal.JournalId(children[i].InnerText);
		    	   break;			  
		    	}
		    
		    }//end for i
		
         	journalEntries.push(journal);		
			
		}

and I get BCE0015: Node ‘__switch__314’ has not been correctly processed.

Now, if I take this switch, (or a similar switch) and move it outside of this for loop, everything compiles fine. Why does putting a switch inside of a for loop of this structure cause an error? If I change the structure of the for loop to not use the (N in journalList) structure, the script will compile fine. Is this a bug?

In C# at least you always have to have a default: catch all block in a switch statement. Have you tried adding a default: at the end of the switch statement?

Hi.

Adding a default case gives the same results.

I suggest you use a if statement in this particular case instead. I have filed a bug against the JS compiler.

Thanks. I ended up doing just that.