Yes, valueOf() in the context of filter operator will return you the
reference to the node currently processed. E4X, although uses special
opcodes, from the AS3 programmer's perspective is the same part of the
language as functions or variables are :) So, when you iterate over XML
using E4X operators you are essentially doing that "in code". If you want,
it's not like XPath or regular expressions, think of LinQ as a better
analogue.
So, if the requirement is to check if all fields of an object have
corresponding attributes, I would do it like so:

var xml : XML =
<nodes>
<item foo="12345"/>
<item foo="34567" bar="qwerty"/>
</nodes>;
var pattern:Object = { "foo" : true, "bar" : true };
xml.item.(this.check(valueOf(), pattern)).(trace(valueOf().toXMLString()));

. . .

private function check(node:XML, pattern:Object):Boolean
{
for (var p:String in pattern)
{
if (!("@" + p in node)) return false;
}
return true;
}

Best.

Oleg

Reply via email to