I'm using VTD to parse and split very large XML files and require the actual XPath of the current element pointed to by the cursor after a call to AutoPilot.evalXPath()
.
Consider the following XML:
<atlas>
<continents>
<continent>
<name>North America</name>
<countries>
<country>
<name>Canada</name>
</country>
<country>
<name>US</name>
</country>
</countries>
</continent>
<continent>
<name>South America</name>
<countries>
<country>
<name>Chile</name>
</country>
<country>
<name>Brazil</name>
</country>
</countries>
</continent>
</continents>
</atlas>
I am initializing AutoPilot
with autopilot.selectXPath("/atlas/continents/continent/countries/country");
As I iterate through the matches using autopilot.evalXPath()
, I need the absolute XPath of each element, for example like /atlast/continents/continent[1]/countries/country[2]
.
I tried almost all methods in VTDNav
and AutoPilot
-
VTDNav.getXPathStringVal() / VTDNav.getXPathStringVal(short mode)
VTDNav.toNormalizedXPathString(int j)
AutoPilot.getExprString()
Any ideas?