I am trying to get the original XML out of a VTD+XML bytearray but I'm getting the wrong data. The output of dumpXML() has what appears to be data from the index tacked on to the front. Here's the example code:
//Build VTD+XML index
VTDGen gen = new VTDGen();
gen.setDoc(xml.getBytes());
gen.parse(false);
VTDNav nav = gen.getNav();
ByteArrayOutputStream os = new ByteArrayOutputStream();
nav.writeIndex(os);
//Get original XML
ByteArrayOutputStream osOrig = new ByteArrayOutputStream();
nav.dumpXML(osOrig);
//Load VTD+XML into new Gen
VTDGen gen2 = new VTDGen();
VTDNav nav2 = gen2.loadIndex(os.toByteArray());
//Attempt to get original XML
ByteArrayOutputStream os2 = new ByteArrayOutputStream();
nav2.dumpXML(os2);
At this point osOrig and os2 should contain the same content, right? However osOrig is correct, but os2 has characters tacked on to the front. What am I doing wrong?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This issue has been fixed you just have to go to VTD-XML CVS repository to check out the latest update...
please post directly to vtd-xml-users mailing list if you need further instruction...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to get the original XML out of a VTD+XML bytearray but I'm getting the wrong data. The output of dumpXML() has what appears to be data from the index tacked on to the front. Here's the example code:
//Build VTD+XML index
VTDGen gen = new VTDGen();
gen.setDoc(xml.getBytes());
gen.parse(false);
VTDNav nav = gen.getNav();
ByteArrayOutputStream os = new ByteArrayOutputStream();
nav.writeIndex(os);
//Get original XML
ByteArrayOutputStream osOrig = new ByteArrayOutputStream();
nav.dumpXML(osOrig);
//Load VTD+XML into new Gen
VTDGen gen2 = new VTDGen();
VTDNav nav2 = gen2.loadIndex(os.toByteArray());
//Attempt to get original XML
ByteArrayOutputStream os2 = new ByteArrayOutputStream();
nav2.dumpXML(os2);
At this point osOrig and os2 should contain the same content, right? However osOrig is correct, but os2 has characters tacked on to the front. What am I doing wrong?
Thanks
Also: I'm using version 2.3
hmm.. it may be a bug, let me investigate and get back..
It is a bug and the fix (java version) has been checked in ...
Will we get a new version?
Sorry, but I 'm new to this forum.
I see the same issue in v2.4
This issue has been fixed you just have to go to VTD-XML CVS repository to check out the latest update...
please post directly to vtd-xml-users mailing list if you need further instruction...