I have a xml file for example like this
<root>
<test>
<bla>test1</bla>
</test>
<test>
<bla>test2</bla>
</test>
<test>
</test>
</root>
Now I want to parse it with the vtd-xml-parser by using XPath expressions. First I search for the test tags by
VTDNav vn = vg.getNav();
AutoPilot ap = new AutoPilot(vn);
ap.selectXPath("//test");
Now I want to search within this test tags for bla tags
int result = -1;
int count = 0;
while ((result = ap.evalXPath()) != -1) {
// evaluate XPath Expressions within the test tags
}
Can someone tell me how to make this expressions? I don't want to search the entire document for bla tags as I want to be able to assign the bla tags to the test tags. I cannot do this if the bla tags are empty for example and I search the entire document for the bla tag.
You can declare another autopilot (shown below), although it is not always the simplest way
then nest that in the loop
But the catch is that the second xpath needs to be relative xpath expression...