Parse the shortcuts list file. (B2)
This does not use the shortcuts yet, it only reads up the file
in memory.
Change-Id: Ib9b8594c2dd6a38b1209b01c80e8894696312998
diff --git a/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java b/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java
index 838cda5..4720e9d 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/XmlDictInputOutput.java
@@ -181,6 +181,26 @@
}
/**
+ * SAX handler for a shortcut XML file.
+ */
+ static private class ShortcutHandler extends AssociativeListHandler {
+ private final static String ENTRY_TAG = "entry";
+ private final static String ENTRY_ATTRIBUTE = "shortcut";
+ private final static String TARGET_TAG = "target";
+ private final static String REPLACEMENT_ATTRIBUTE = "replacement";
+ private final static String TARGET_PRIORITY_ATTRIBUTE = "priority";
+
+ public ShortcutHandler() {
+ super(ENTRY_TAG, ENTRY_ATTRIBUTE, TARGET_TAG, REPLACEMENT_ATTRIBUTE,
+ TARGET_PRIORITY_ATTRIBUTE);
+ }
+
+ public HashMap<String, ArrayList<WeightedString>> getShortcutMap() {
+ return getAssocMap();
+ }
+ }
+
+ /**
* Reads a dictionary from an XML file.
*
* This is the public method that will parse an XML file and return the corresponding memory