- 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('<');
+ String line = scan.next().trim();
+
+ if (!started) {
+ started = line.equals("<!--Chapters-->");
+ } else {
+ if (line.equals("</form>")) {
+ break;
+ }
+
+ if (line.startsWith("<a href=")
+ || line.contains("class=\"chapter-title\"")) {
+ // Chapter name
+ String name = line;
+ int pos = name.indexOf('>');