diff options
| author | Ben Linskey | 2014-01-07 17:40:17 -0500 |
|---|---|---|
| committer | Ben Linskey | 2014-01-07 17:40:17 -0500 |
| commit | 341ee65afbd5932b441f179ba45ec8808f49af72 (patch) | |
| tree | a0e7401c9806bde549801302e5cf80f02f3d88e3 /src/com/benlinskey | |
| parent | c0ac0c2b1b4cc304e4f0428ca6ddde3473cfa78f (diff) | |
| download | greek-reference-database-creator-1.1.0.tar.gz | |
Add Sources Cited to syntax databasev1.1.0
Diffstat (limited to 'src/com/benlinskey')
| -rw-r--r-- | src/com/benlinskey/grdbc/SyntaxCreator.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/benlinskey/grdbc/SyntaxCreator.java b/src/com/benlinskey/grdbc/SyntaxCreator.java index de93d77..10637aa 100644 --- a/src/com/benlinskey/grdbc/SyntaxCreator.java +++ b/src/com/benlinskey/grdbc/SyntaxCreator.java @@ -33,8 +33,6 @@ import org.xml.sax.SAXException; /** * Reads in an XML file containing the Overview of Greek Syntax text and stores * sections of the text in an SQLite database. - * <p> - * Note that the Sources Cited section is omitted, as it is on Perseus. * @author Ben Linskey * */ @@ -146,6 +144,13 @@ public class SyntaxCreator { Matcher matcher = pattern.matcher(line); matcher.find(); chapter = matcher.group(1); + + if (chapter.equals("Sources Cited")) { + section = chapter; + xml.delete(0, xml.length()); + xml.append("<section>"); + xml.append("<head>Sources Cited</head>"); + } } else if (line.startsWith("<div2")) { // Get section title. line = in.readLine(); // Next line is "head" element with title. @@ -173,6 +178,19 @@ public class SyntaxCreator { insertStatement.setString(2, section); insertStatement.setString(3, transcodedXml); insertStatement.addBatch(); + } else if (line.contains("</div1>") && chapter.equals("Sources Cited")) { + // Get any XML before the "</div2>" tag. + String[] split = line.split("</div1>"); + xml.append(split[0]); + + // Add closing root tag. + xml.append("</section>"); + + // Add data to database. + insertStatement.setString(1, chapter); + insertStatement.setString(2, section); + insertStatement.setString(3, xml.toString()); + insertStatement.addBatch(); } else { // Get next line of XML. xml.append(line); |