Performance problem when getting text from a context node with VTD-XML
I've found a solution, which doesn't improve the performance, but is a lot shorter. I didn't know about the evalXPathToString() method.

protected String extractText(VTDNav v, String path) throws Exception {
  AutoPilot ap = new AutoPilot(v);
  ap.selectXPath(path);
  return ap.evalXPathToString();
}


Furthermore, the check in my old version whether the path contains a @ was buggy. It returned true for a path like /a[@b='c'] and executed getAttrVal() for it, which is wrong.