|
From: Jimmy Z. <jz...@xi...> - 2017-03-29 19:22:11
|
it is not kept by the xml parser in order to reduce memory
requirement... basically, after start and ending element is done,
ending tag serves no significant purpose..in fact, the combination of
token depth is sufficient to indicate the location in the document...
I don't think that part is ambiguous ...
----- Original Message -----
From: Erik Fäßler
To:"Nil Ratan Sahoo"
Cc:"vtd...@li..."
Sent:Tue, 28 Mar 2017 16:13:08 +0200
Subject:Re: [Vtd-xml-users] VTD 2.13.1: No TOKEN_ENDING_TAG tokens
Hi again,
I’m afraid the combination of TOKEN_STARTING_TAG and depth is
ambiguously. Text tokens and property tokens (e.g. TOKEN_PI_NAME) have
the same depth as the element starting tag.To have explicit
TOKEN_ENDING_TAG tokens would be really helpful and enhance the
usability of VTD-XML a lot. I am fighting half the day for reliable
way to tell whether I’m still in a specific element or not. I will
make it eventually, but by now I wished I would just have used StAX. I
would have finished hours ago if I had. Actually I’m thinking of
changing to StAX right now, might be quicker…
Best,
Erik
On 27 Mar 2017, at 19:39, Nil Ratan Sahoo wrote:
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 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 [3]! http://sdm.link/slashdot
[4]_______________________________________________
Vtd-xml-users mailing list
Vtd...@li... [5]
https://lists.sourceforge.net/lists/listinfo/vtd-xml-users [6]
Links:
------
[1] mailto:nil...@ya...
[2] mailto:eri...@un...
[3] http://slashdot.org
[4] http://sdm.link/slashdot
[5] mailto:Vtd...@li...
[6] https://lists.sourceforge.net/lists/listinfo/vtd-xml-users
|