Menu

Can I via index to go to specified location?

John Zhu
2009-07-02
2013-05-15
  • John Zhu

    John Zhu - 2009-07-02

    I wonder how to go to a specified location when I got the element or node index. e.g.
    XML:
    <a>
        <b>test</b>
    </a>

    I use the XPath to get the index of b element. I suppose the index is 6.
    How to go  to the b element via the index 6.

     
    • jimmy zhang

      jimmy zhang - 2009-07-03

      you are not supposed to... because an index location may not correspond to a node location..
      think of attribute name/values, comments, texts... etc,, so you can navigate using the curse interface, and retrieve related indexes, but not the other way around, which is by design

       
    • jimmy zhang

      jimmy zhang - 2009-07-03

      but you can do push and pop... I think u alread know that :)

       

Log in to post a comment.