In OutputDocument.java in writeTo(final Writer writer, int begin, int end)
When the outputSegments are empty you call Util.appendTo but you do not pass begin and end to the method. So it ends up outputting the entire document.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried sending you a private message. I guess it didn't work.
The file is OutputDocument.java
The code is starting on line 361:
public void writeTo(final Writer writer, int begin, int end) throws IOException {
try {
if (outputSegments.isEmpty()) {
Util.appendTo(writer,sourceText,begin,end); //I changed this line
return;
}
int pos=begin;
Collections.sort(outputSegments,OutputSegment.COMPARATOR);
OutputSegment lastOutputSegment=null;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Brian,
I got your private message but didn't have a chance to respond.
The method you have fixed seems to be one of your own creation, as there is no OutputDocument.writeTo method with those parameters.
Cheers
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found and fixed a bug.
In OutputDocument.java in writeTo(final Writer writer, int begin, int end)
When the outputSegments are empty you call Util.appendTo but you do not pass begin and end to the method. So it ends up outputting the entire document.
Please send me the source code of the method you have changed. I cannot find a method with the signature you have provided.
I tried sending you a private message. I guess it didn't work.
The file is OutputDocument.java
The code is starting on line 361:
public void writeTo(final Writer writer, int begin, int end) throws IOException {
try {
if (outputSegments.isEmpty()) {
Util.appendTo(writer,sourceText,begin,end); //I changed this line
return;
}
int pos=begin;
Collections.sort(outputSegments,OutputSegment.COMPARATOR);
OutputSegment lastOutputSegment=null;
Hi Brian,
I got your private message but didn't have a chance to respond.
The method you have fixed seems to be one of your own creation, as there is no OutputDocument.writeTo method with those parameters.
Cheers
Martin
Oh ok that would explain why it was busted then ;)
So I've got this really good idea for a new method in the OutputDocument class.
As you now know I added a writeTo that takes start and end parameters. Very handy when you want to export part of the document with replacements.
So send me an email and I'll send you my entire OutputDocument.java file.
Brian
OutputDocument.writeTo(Writer writer , int begin, int end) has been added in version 2.6.
The output now also excludes any output segments that are enclosed by other output segments.
Until version 2.6 is officially released, a development version is available here:
http://jerichohtml.sourceforge.net/temp/jericho-html-2.6-dev.zip