I've run into a curious problem with E4X (which is otherwise
spectacular). Given this document:

var document:XML =
        <document id="1">
                <object id="4">
                        <content id="3">
                                <node id="20" />
                        </content>
                </object>
                <object id="7">
                </object>
        </document>;

I would have expected this code to work:

        var list:XMLList = game..(@id == 7);

But the compiler gives me an error message:

        Syntax error: expecting doublecolon before rightparen.

Can I not use the descendant selector ("..") directly on an XML
object? All of the examples I've seen use it on XMLList objects, but I
didn't see any specific mentions that it only works with XMLList
objects. For now, it seems I have to do this to get the result I'm
looking for:

        var list:XMLList = game.descendants().(@id == 7);

Which is fine, I just need to make sure I'm not misunderstanding the
E4X syntax or rules.

Thanks,

Troy.


Reply via email to