paip.获取proxool的配置  xml读取通过jdk xml 初始化c3c0在代码中



 xml读取通过jdk xml

初始化c3c0在代码中。。

。。。





作者Attilax  艾龙,  EMAIL:1466519819@qq.com

来源:attilax的专栏

地址:http://blog.csdn.net/attilax





proxoolController.ini();
 

ComboPooledDataSource  dataSource=new   ComboPooledDataSource();       

          dataSource.setUser( proxoolController.user);       

          dataSource.setPassword( proxoolController.pwd);       

          dataSource.setJdbcUrl( proxoolController.url );

          dsx=dataSource;





 

--------------------------- proxoolController--------------  

 

 public static void ini() {

if(url==null)

{

String s=god.getClassPath()+"/proxool.xml";

String xml_str=fileC0.Read(s);

System.out.println(getValue("",xml_str));

}

 



 

System.out.println("f" );

}





public static String getValue(String keyName,String xml_s)   {

//1.获得DocumentBuilderFactory  对象

DocumentBuilderFactory  builderFactory=DocumentBuilderFactory .newInstance();

//2。获得DocumentBuilder对象

DocumentBuilder documentBuilder;

try {

documentBuilder = builderFactory.newDocumentBuilder();



//3.使用documentBuilder来解析XML生成Document对象

Document document=documentBuilder.parse(new InputSource( new StringReader( xml_s ) ) );

document.normalize(); // 删除非XML数据

NodeList nodeList=document.getElementsByTagName("driver-url");

Node node=nodeList.item(0);





NodeList li2=document.getElementsByTagName("property");

for(int i=0;i<li2.getLength();i++)

{

Node nd=li2.item(i);

String name=   nd.getAttributes().getNamedItem("name").getTextContent();

String value=   nd.getAttributes().getNamedItem("value").getTextContent();

if(name.equals("user"))

user=value;

if(name.equals("password"))

pwd=value;

}



url=node.getTextContent();

url=url.trim();

url=url.replace('\n', ' ');

url=url.replace('\t', ' ');url=url.trim();

return node.getTextContent();





} catch ( Exception e) {

 

e.printStackTrace();

}

return null;





}

paip.获取proxool的配置 xml读取通过jdk xml 初始化c3c0在代码中总结的更多相关文章

  1. Java获取路径方法&相对路径读取xml文件方法

    (1).request.getRealPath("/");//不推荐使用获取工程的根路径 (2).request.getRealPath(request.getRequestURI ...

  2. Spring MVC框架下在java代码中访问applicationContext.xml文件中配置的文件(可以用于读取配置文件内容)

    <bean id="propertyConfigurer" class="com.****.framework.core.SpringPropertiesUtil& ...

  3. proxool的配置

    //依赖的包:commons-logging-api-1.1.jar,commons-logging-1.0.4.jar,proxool-0.9.1.jar,proxool-cglib.jar,cgl ...

  4. Spring中配置和读取多个Properties文件--转

    public class PropertiesFactoryBeanextends PropertiesLoaderSupportimplements FactoryBean, Initializin ...

  5. Spring中配置和读取多个Properties文件

    一个系统中通常会存在如下一些以Properties形式存在的配置文件 1.数据库配置文件demo-db.properties: database.url=jdbc:mysql://localhost/ ...

  6. 封装游戏配表读取和存储(xml格式);支持行列存取,标题存取

    做服务器肯定会涉及到游戏配表,而读取游戏配表是一个必备技能; 之前一直都是采用TinyXml直接读,匹配字符串,每次加个表都是一大坨代码,看着也是心累; 因此利用了闲暇的时间封装了一个 xml配置表 ...

  7. c# XML读取

    System.Xml 命名空间 https://msdn.microsoft.com/zh-cn/library/gg145036(v=vs.110).aspx 一.读取 1.通过 XmlDocume ...

  8. Java读取CSV和XML文件方法

    游戏开发中,读取策划给的配置表是必不可少的,我在之前公司,策划给的是xml表来读取,现在公司策划给的是CSV表来读取,其实大同小异,也并不是什么难点,我就简单分享下Java如何读取XML文件和CSV文 ...

  9. 读取properties和xml中配置文件的值

    五种方式让你在java中读取properties文件内容不再是难题 在java中读取properties和xml文件中的方法:https://www.cnblogs.com/ConfidentLiu/ ...

随机推荐

  1. Selenium2+python自动化17-JS处理滚动条

    前言 selenium并不是万能的,有时候页面上操作无法实现的,这时候就需要借助JS来完成了. 常见场景: 当页面上的元素超过一屏后,想操作屏幕下方的元素,是不能直接定位到,会报元素不可见的. 这时候 ...

  2. Jar依赖很多,找不到重复的包??好工具来帮助您

    这里下载 http://download.csdn.net/download/steven2088/8563873 之前的上传错误,新url http://download.csdn.net/deta ...

  3. 20145225《Java程序设计》 第10周学习总结

    20145225<Java程序设计> 第10周学习总结 教材学习内容总结 一.网络编程 网络编程就是在两个或两个以上的设备(例如计算机)之间传输数据: 程序员所作的事情就是把数据发送到指定 ...

  4. iOS 微信支付

    相关资料 SDK下载:https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=11_1 APP端开发步骤说明:https://pay.weixin ...

  5. [更新中]并发和并行(Concurrency and Parallelism)

    书籍的简称: CSPPSE: Computer System: a programmer's perspective Second Edition 术语并发是一个通用的概念, 指同时具有多个活动的系统 ...

  6. sublime构建执行go程序真爽

    1.安装gosublime插件 2.直接在sublime下调试运行共程序,不用去cmd了: 选择编译系统,编译,出现下面的模拟命令行,直接执行go的命令即可,比如go run process.go,结 ...

  7. 2287: 【POJ Challenge】消失之物

    Description ftiasch 有 N 个物品, 体积分别是 W1, W2, ..., WN. 由于她的疏忽, 第 i 个物品丢失了. "要使用剩下的 N - 1 物品装满容积为 x ...

  8. myeclipse2013以及以后的最新版各种破解(其实就是获取活跃码而已)

    当你下到最新版的myeclipse-blue的时候你是否会为注册激活而烦恼呢,别担心,其实激活也就那么点事儿,请遵循我如下做法就可以了: 免积分下载破解地址 http://download.csdn. ...

  9. 上线踩坑引发的处理方式---lsof,strace

    两个跟踪进程的linux命令 lsof -p pidstrace -p pid快速跟踪进程出现问题的地方.由于进程本身运行良好,但是内部一直等待第三方哪个应答,导致进程假死.引用自:http://li ...

  10. jQuery遮罩层效果

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...