|
From: Erik F. <eri...@un...> - 2017-03-27 14:59:06
|
Hi Jimmy,
I am currently building a program using VTD that parses the XML document element-wise. That means that when a TOKEN_START_TAG token is encountered, a specific class is called that processes the current element. For this, the called class iterates over the tokens until it finds the end of the element. I thought I could just wait for a TOKEN_ENDING_TAG token and check if it matches the original TOKEN_START_TAG and the token depth of the start token. However, it seams that absolutely no token is of type TOKEN_ENDING_TAG in the whole document. My code:
for (int i = vn.getCurrentIndex(); i < vn.getTokenCount(); i++) {
System.out.println(i);
if (vn.getTokenType(i) == VTDNav.TOKEN_ENDING_TAG)
{
System.out.println("Ending token found!");
System.out.println(vn.toString(i));
break;
}
}
This code never prints out the “Ending token found!” line. It just counts through all tokens up to vn.getTokenCount().
Am I doing something wrong?
Thanks!
Best regards,
Erik |