xml配置文件读取

        String filePath = Thread.currentThread().getContextClassLoader().getResource("MemCachedConfig.xml").getPath().substring(1);
        File file = new File(filePath.replaceAll("%20"," "));
        try{
            if(file.exists()){ //如果可以成功加载配置文件
                SAXReader sr = new SAXReader();
                Document doc = sr.read(file);
                Element Root = doc.getRootElement(); //获得根节点
                Element Enabled = (Element)Root.selectSingleNode("Enabled"); //获得是否启用memcached节点
                Element Servers = (Element)Root.selectSingleNode("Servers"); //获得可用的服务器列表父节点
                Element Config = (Element)Root.selectSingleNode("Config"); //获得运行环境参数列表父节点                
            }
        }catch(Exception e){
            System.out.println(e.toString());
        }

   dom4j
   dom4j
   1.6