I've been using E4X expressions and it has never caused a problem. Today I got this error which is driving me crazy. Checked everything thousand times, searched web, but nothing.
So this is my query for the value:
var objectName:String = myXML.objects.object.(@id==objectId);
where objectId is an int.
This is the part of my XML:
<objects>
<object id="0">value 1</object>
<object id="1">value 2</object>
<object id="2">value 3</object>
</objects>
When the above line is run I get an error which seems like a total nonsense to me:
ReferenceError: Error #1065: Variable id is not defined.
It's because not all of your
object
nodes has theid
attribute, try more safety way to search through the attributes withhasOwnProperty("@id")
checks: