use of com.zhan_dui.dictionary.handlers.DictionaryXMLHandler in project little-bear-dictionary by daimajia.
the class QueryProcessor method parseConfigureXML.
private DictionaryParseInfomation parseConfigureXML(String childDir, String xmlPath) throws ParserConfigurationException, SAXException, IOException {
DictionaryParseInfomation dictionaryParseInfomation;
if (mCacheXMLInformation.containsKey(xmlPath)) {
dictionaryParseInfomation = mCacheXMLInformation.get(xmlPath);
} else {
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
SAXParser saxParser = saxParserFactory.newSAXParser();
DictionaryXMLHandler dictionaryXMLHandler = new DictionaryXMLHandler();
String xmlFilePath = Constants.getSaveDirectory() + File.separator + childDir + File.separator + xmlPath;
saxParser.parse(new File(xmlFilePath), dictionaryXMLHandler);
dictionaryParseInfomation = dictionaryXMLHandler.getResults();
mCacheXMLInformation.put(xmlPath, dictionaryParseInfomation);
}
return dictionaryParseInfomation;
}
Aggregations