public String extractRange(final String input, final Location from, final Location to) {
        final StringReader stringReader = new StringReader(input);
        final StringBuilder output = new StringBuilder();
        int line = 1;
        int col = 1;
        int lastChar = -1;
        boolean isFirstChar = true;

        int chr;

        try {
            while (true) {
                chr = stringReader.read();
                if (chr == -1) {
                    break;
                }

                if (isFirstChar) {
                    isFirstChar = false;
                } else if (lastChar == '\n') {
                    line++;
                    col = 1;
                } else if (chr == '\n') {
                    // Do nothing
                } else {
                    col++;
                }
                lastChar = chr;

                boolean isOnOrPastFromLocation = line > from.getLineNo()
                        || (line == from.getLineNo() && col >= from.getColNo());
                boolean isBeforeOrOnToLocation = line < to.getLineNo()
                        || (line == to.getLineNo() && col <= to.getColNo());

                if (isOnOrPastFromLocation && isBeforeOrOnToLocation) {
                    output.append(charToVisible((char) chr));
                }
                if (!isBeforeOrOnToLocation) {
                    break;
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return output.toString();
    }
@param input The string to extract the range from
@param from  Inclusive
@param to    Inclusive
@return The extracted string
stroom-pipeline/src/test/java/stroom/pipeline/xml/converter/ds3/TestDS3.java