I bet you are being confused, because you are expecting the first node
in the NodeList to be the element, and you're not considering the text
nodes which may be present -- or comment nodes, etc.

Note that there may be more than one text node unless you've
normalized, which collapses adjacent text nodes into one.

Blinding indexing into nodelists this way is unlikely to be a good
idea. You should at least check that the returned node is of the type
you expected -- but if you want the first element, you should be in a
loop looking for the first element, and ignoring any text, or erroring
on any non-whitespace text, or whatever is appropriate for your
circumstance.

You don't really say what you're doing, but perhaps you really want to
be using a higher-level API -- perhaps XPath.

On Oct 22, 12:36 pm, Murphy <[email protected]> wrote:
> > It seems like the first element of a NodeList begins at 0 for API<8
> > but start at 1 for API 8.
>
> I wanted to say the opposite :
>
> > It seems like the first element of a NodeList begins at 1 for API<8
> > but start at 0 for API 8.
>
> Nobody with that problem?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to