views:

77

answers:

2

What it says on the tin: I have an XMLList, and I want to find where in it a particular XML item falls. First index is good enough for my purposes.

Note that I have no problem writing a function to do this by hand... but I was hoping that the API has something buried somewhere that'll do it for me. I didn't see it, though.

+1  A: 

Just loop through the xmllist until you find one that matches, then return the index in your loop (for loop with an index).

Sean Clark Hess
Yeah, that's the by-hand method. I was hoping there'd be a method in the E4X API to do it.
Chris R
Well, maybe the issue is: Why do you want to know the index? Maybe there's a way to solve your problem without it. It's certainly easy to find particular items using e4x
Sean Clark Hess
A: 

Without a code example it's a bit difficult to know what you're trying to do exactly, but maybe XML.childIndex() could the solution?

Niko Nyman
That will find me the index of the child in the element that is its parent, but not its position in an XMLList that may be the result of a query.
Chris R