Is this a bug in Flash's E4X parsing?



Had to narrow down why someone else's AIR app wasn't loading anything today, and discovered a (BUG?) quirk with this code:



public static function getScreenDataByID(id:String="",dispose:Boolean = true) : ScreenVO {
var xml:XML = assets.getXml("app-data");
var screen:XMLList = new XMLList(xml.screen.(@id == id));
trace('screen=', screen);
return screen.data;

}

//output: screen=


After a lot of head banging I changed it to this:



public static function getScreenDataByID(id:String="",dispose:Boolean = true) : ScreenVO {
var xml:XML = assets.getXml("app-data");
var newId:String = id.toString();
var screen:XMLList = new XMLList(xml.screen.(@id == newId));
trace('screen=', screen);
return screen.data;

}
//output: screen=**correct data from xml***


Is this a bug in Flash?


I have never come across anything like this.




  • Just to clarify, the id being passed to the function was a String like 'home' and was of type String already.




  • and the assets.getXml function returned the correct xml in both cases.




No comments:

Post a Comment