aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Linskey2014-02-02 01:29:38 -0500
committerBen Linskey2014-02-02 01:29:38 -0500
commitb83b36b66ca63c004aa9a8719009145689411380 (patch)
tree2bd7c44942583578a1cb82b0bcd793a9995401c4
parente847431136d889ef9ba8d4683beee3cc4e1776f1 (diff)
parentc599f41101c6015188b5e115fea1cb772151c65b (diff)
downloadgreek-reference-database-creator-b83b36b66ca63c004aa9a8719009145689411380.tar.gz
Merge branch 'master' of github.com:blinskey/greek-reference-database-creator
-rw-r--r--README.md4
-rw-r--r--src/com/benlinskey/grdbc/LexiconCreator.java2
-rw-r--r--src/com/benlinskey/grdbc/SyntaxCreator.java24
3 files changed, 22 insertions, 8 deletions
diff --git a/README.md b/README.md
index 7493e9e..973242a 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,6 @@
This program creates the SQLite database used in the [Greek Reference][] app for Android.
-## Important Note
-
-This version of GRDBC is designed to work with a new version of Greek Reference that will be hosted on GitHub. It replaces the old version of GRDBC currently hosted on Bitbucket and is incompatible with the version of Greek Reference currently hosted on Bitbucket.
-
## Dependencies
- SQLite3
diff --git a/src/com/benlinskey/grdbc/LexiconCreator.java b/src/com/benlinskey/grdbc/LexiconCreator.java
index 6dca163..ec3a99a 100644
--- a/src/com/benlinskey/grdbc/LexiconCreator.java
+++ b/src/com/benlinskey/grdbc/LexiconCreator.java
@@ -106,7 +106,7 @@ public class LexiconCreator {
try {
String dropTable = "DROP TABLE IF EXISTS " + TABLE_NAME;
String createTable = "CREATE TABLE " + TABLE_NAME + " (" +
- "_ID INTEGER PRIMARY KEY, " +
+ "_id INTEGER PRIMARY KEY, " +
"betaNoSymbols VARCHAR(100), " +
"betaSymbols VARCHAR(100), " +
"greekFullWord VARCHAR(100), " +
diff --git a/src/com/benlinskey/grdbc/SyntaxCreator.java b/src/com/benlinskey/grdbc/SyntaxCreator.java
index 172b53e..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
*
*/
@@ -109,7 +107,7 @@ public class SyntaxCreator {
try {
String dropTable = "DROP TABLE IF EXISTS " + TABLE_NAME;
String createTable = "CREATE TABLE " + TABLE_NAME + " (" +
- "_ID INTEGER PRIMARY KEY, " +
+ "_id INTEGER PRIMARY KEY, " +
"chapter VARCHAR(100), " +
"section VARCHAR(100), " +
"xml TEXT)";
@@ -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);