修改LangSelector逻辑
This commit is contained in:
parent
05802a9524
commit
b9986333a0
|
|
@ -16,15 +16,14 @@ import org.w3c.dom.Document;
|
||||||
* @author Jared Ye
|
* @author Jared Ye
|
||||||
*/
|
*/
|
||||||
public abstract class LangSelector {
|
public abstract class LangSelector {
|
||||||
|
//
|
||||||
private static String ConfigPath="";
|
private static String ConfigPath="";
|
||||||
private static Document Data;
|
private static Document Data;
|
||||||
public static boolean Loaded=false;
|
public static boolean Loaded=false;
|
||||||
private static XPath xpath = XPathFactory.newInstance().newXPath();
|
private static XPath xpath = XPathFactory.newInstance().newXPath();
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
ConfigPath=findConfigFilePath();
|
init();
|
||||||
Data = init(ConfigPath);
|
|
||||||
Loaded=true;
|
Loaded=true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//初始化的时候没有读到config.xml
|
//初始化的时候没有读到config.xml
|
||||||
|
|
@ -78,16 +77,18 @@ public abstract class LangSelector {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Document init(String ConfigPath) throws Exception {
|
public static Document init() throws Exception {
|
||||||
// 创建Document对象
|
// 创建Document对象
|
||||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
dbf.setValidating(false);
|
dbf.setValidating(false);
|
||||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
// 创建XPath对象
|
// 创建XPath对象
|
||||||
LangSelector.ConfigPath =ConfigPath;
|
LangSelector.ConfigPath =findConfigFilePath();
|
||||||
//JOptionPane.showMessageDialog(null,"当前工作目录:"+ConfigPath);
|
//JOptionPane.showMessageDialog(null,"当前工作目录:"+ConfigPath);
|
||||||
// LangSelector.ConfigPath=new File(LangSelector.ConfigPath).getAbsolutePath();
|
// LangSelector.ConfigPath=new File(LangSelector.ConfigPath).getAbsolutePath();
|
||||||
return db.parse(LangSelector.ConfigPath);
|
Document doc=db.parse(new File(LangSelector.ConfigPath));
|
||||||
|
Data=doc;
|
||||||
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue