import com.ximpleware.*;
class Overwrite{
public static void main(String s[]) throws Exception{
VTDGen vg = new VTDGen();
vg.setDoc("good ".getBytes());
vg.parse(true);
VTDNav vn = vg.getNav();
int i=vn.getText();
//print "good"
System.out.println("text ---> "+vn.toString(i));
if (vn.overWrite(i,"bad".getBytes())){
//overwrite, if successful, returns true
//print "bad" here
System.out.println("text ---> "+vn.toString(i));
}
}
}
Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/PUxXI3xVS3k/11421