- String line = scan.next();
- if (line.contains("class=\"chapter_link\"")
- || line.contains("class='chapter_link'")) {
- // Chapter name
- String name = line;
- int pos = name.indexOf('>');
- if (pos >= 0) {
- name = name.substring(pos + 1);
- pos = name.indexOf('<');
- if (pos >= 0) {
- name = name.substring(0, pos);
- }
- }
- // Chapter content
- pos = line.indexOf('/');
- if (pos >= 0) {
- line = line.substring(pos); // we take the /, not +1
- pos = line.indexOf('"');
- if (pos >= 0) {
- line = line.substring(0, pos);
- }
+ String line = scan.next().trim();
+
+ if (!started) {
+ started = line.equals("<!--Chapters-->");
+ } else {
+ if (line.equals("</form>")) {
+ break;