Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6079177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:55:02+00:00 2026-05-23T10:55:02+00:00

I want to navigate the xml using vtd-xml, and I want to navigate to

  • 0

I want to navigate the xml using vtd-xml, and I want to navigate to any index given by the XPath. For example:

vg.parseFile("/tmp/somexml.xml",true);
VTDNav vn = vg.getNav();                
AutoPilot ap = new AutoPilot();
ap.selectXPath("//someelement");                
ap.bind(vn);
for (int i = ap.evalXPath(); i != -1;) {
try {                        
vn.toElement(i);                                               
} catch (Exception ex) {
logger.error(null, ex);
}

I debugged and for example I get the index 40, but when I try toElement(40) it fails. I keep getting invalid navigation. Is there anyway I can navigate to any element?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:55:02+00:00Added an answer on May 23, 2026 at 10:55 am

    You can’t ask vtdNav to go to any index value, VTD-XML doesn’t work like that for the simple reason that the index is not guaranteed to be of the type of element.

    There are ways for you to save/load a node position, or recover a node position from an index value. But in general a node position is not guaranteed to be a valid tree position (attribute value e.g.)…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to conditionally navigate to some page. If some condition is true i
I want to navigate to a website using pre-defined cookies, Add some text to
Like the title says, I am using devise. I want to navigate to /users/1
I can't navigate the XML doc programmatically and I need an one-line XPath solution
I'm struggling to navigate to my 'user' element in my XML; I want a
I want to navigate to the N-th level of an object, and serialize it's
I want to navigate to the particular page in my application and i also
I want to open a webpage in internet explorer and navigate to a page
I want to make a site where there user can basically navigate the web
When I use Emacs I want to be able to easily display and navigate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.