From: Nil R. S. <nil...@ya...> - 2017-03-27 18:00:20
|
Hi Erik, By default VTDNav.TOKEN_ENDING_TAG is not part of index, you can use VTDNav.TOKEN_STARTING_TAG and depth to determine end of a tag. thanksNil On Monday, 27 March 2017 8:01 AM, Erik Fäßler <eri...@un...> wrote: 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------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ Vtd-xml-users mailing list Vtd...@li... https://lists.sourceforge.net/lists/listinfo/vtd-xml-users |