Hi, I am using the VTD-XML Java library v2.13.4 and have a test case that is causing a null pointer exception within the library. Should I report the bug with the test case? Is anyone maintaining the project? I don't see any activity in over a year.
Attaching a revised test case that just makes the code more correct, to remove the t++ increment within the loop for the TextIter approach: while ((t = ti.getNext()) != -1) { nodeText += vn.toString(t++); } while ((t = ti.getNext()) != -1) { nodeText += vn.toString(t); }
Hi Jimmy, I have put together a comprehensive test, attached, that demonstrates various ways in which the VTD-XML parser methods provide varying results when the goal is to fetch all the text of a node. The test case consists of a standard single text < 1MB of data, a large CDATA value > 2MB, and a mixed content test. For each input XML, the code tests 4 ways of fetching the node text: xpath text() VTDNav getXPathStringVal() VTDNav getTokenType() loop TextIter Here is the output from the attached...
Hi Jimmy, I tried getXPathStringVal() as follows: VTDNav vn = vg.getNav(); if (vn.matchElement("root")) { System.out.println("getXPathStringVal() val = "+vn.getXPathStringVal()); } Here is the test XML: <root>Some mixed<child>child text</child>content text</root> Here is the output: getXPathStringVal() val = Some mixedchild textcontent text I don't understand why it also grabbed the child node's text. I was expecting it would emit "Some mixedcontent text" Attached is the new test case. I also tried...
Hi Jimmy, Thanks, that makes sense, but what about when an XML node has mixed content like this: <root>Some mixed<child>child text</child> content text</root> The VTDNav.getText() doesn't handle mixed content (VTDNav.getText() just returns "Some mixed" for the XML above instead of "Some mixed content text"), which is why I attempted to handle with my while() loop. So am I hitting a situation where a routine that might work for mixed content then breaks when it hits large CDATA > 1MB? Can you please...
Unexpected result reading node text from a Base64 CDATA value