开发者

E4X get element's next sibling

I have a reference to a XML node which is part of a bigger XML tree. Is there a way to get that elements next/previous sibling without accessing the parent and looking for it? Something like DOM's nextSibling would be what I look for.

edit: Given that there is no natural way to do this with 开发者_运维问答E4X, I'll just stick to the following (except that in my case, I'll store the actual index somewhere instead):

// next sibling:
node.parent().children()[ node.childIndex() + 1 ]
// previous sibling:
node.parent().children()[ node.childIndex() - 1 ]


I don't see any such methods in ECMA-357, 2nd edition. Moreover, "sibling" doesn't seem to appear anywhere in my copy of the standard. If any such methods exist, they exist because Adobe added them as extensions to the spec.


Is this what you are looking for?

http://livedocs.adobe.com/flex/3/langref/flash/xml/XMLNode.html#nextSibling

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜