aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java b/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
index 483473b3c..1d45fd25f 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/makedict/XmlDictInputOutput.java
@@ -40,6 +40,7 @@ import org.xml.sax.helpers.DefaultHandler;
*/
public class XmlDictInputOutput {
+ private static final String ROOT_TAG = "wordlist";
private static final String WORD_TAG = "w";
private static final String BIGRAM_TAG = "bigram";
private static final String SHORTCUT_TAG = "shortcut";
@@ -96,6 +97,11 @@ public class XmlDictInputOutput {
mFreq = Integer.parseInt(attrs.getValue(attrIndex));
}
}
+ } else if (ROOT_TAG.equals(localName)) {
+ for (int attrIndex = 0; attrIndex < attrs.getLength(); ++attrIndex) {
+ final String attrName = attrs.getLocalName(attrIndex);
+ mDictionary.mOptions.mAttributes.put(attrName, attrs.getValue(attrIndex));
+ }
} else {
mState = UNKNOWN;
}
@@ -275,7 +281,13 @@ public class XmlDictInputOutput {
set.add(word);
}
// TODO: use an XMLSerializer if this gets big
- destination.write("<wordlist format=\"2\">\n");
+ destination.write("<wordlist format=\"2\"");
+ final HashMap<String, String> options = dict.mOptions.mAttributes;
+ for (final String key : dict.mOptions.mAttributes.keySet()) {
+ final String value = dict.mOptions.mAttributes.get(key);
+ destination.write(" " + key + "=\"" + value + "\"");
+ }
+ destination.write(">\n");
destination.write("<!-- Warning: there is no code to read this format yet. -->\n");
for (Word word : set) {
destination.write(" <" + WORD_TAG + " " + WORD_ATTR + "=\"" + word.mWord + "\" "