paip.获取proxool的配置 xml读取通过jdk xml 初始化c3c0在代码中总结
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在代码中总结的更多相关文章
- Java获取路径方法&相对路径读取xml文件方法
(1).request.getRealPath("/");//不推荐使用获取工程的根路径 (2).request.getRealPath(request.getRequestURI ...
- Spring MVC框架下在java代码中访问applicationContext.xml文件中配置的文件(可以用于读取配置文件内容)
<bean id="propertyConfigurer" class="com.****.framework.core.SpringPropertiesUtil& ...
- proxool的配置
//依赖的包:commons-logging-api-1.1.jar,commons-logging-1.0.4.jar,proxool-0.9.1.jar,proxool-cglib.jar,cgl ...
- Spring中配置和读取多个Properties文件--转
public class PropertiesFactoryBeanextends PropertiesLoaderSupportimplements FactoryBean, Initializin ...
- Spring中配置和读取多个Properties文件
一个系统中通常会存在如下一些以Properties形式存在的配置文件 1.数据库配置文件demo-db.properties: database.url=jdbc:mysql://localhost/ ...
- 封装游戏配表读取和存储(xml格式);支持行列存取,标题存取
做服务器肯定会涉及到游戏配表,而读取游戏配表是一个必备技能; 之前一直都是采用TinyXml直接读,匹配字符串,每次加个表都是一大坨代码,看着也是心累; 因此利用了闲暇的时间封装了一个 xml配置表 ...
- c# XML读取
System.Xml 命名空间 https://msdn.microsoft.com/zh-cn/library/gg145036(v=vs.110).aspx 一.读取 1.通过 XmlDocume ...
- Java读取CSV和XML文件方法
游戏开发中,读取策划给的配置表是必不可少的,我在之前公司,策划给的是xml表来读取,现在公司策划给的是CSV表来读取,其实大同小异,也并不是什么难点,我就简单分享下Java如何读取XML文件和CSV文 ...
- 读取properties和xml中配置文件的值
五种方式让你在java中读取properties文件内容不再是难题 在java中读取properties和xml文件中的方法:https://www.cnblogs.com/ConfidentLiu/ ...
随机推荐
- The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv
在mybatis配置文件config.xml中报错: The content of element type "configuration" must match "(p ...
- Java写操作
//:ThinkingInJava/net.mindview.io/write2File.java package net.mindview.io; import java.io.BufferedRe ...
- 柬埔寨手机上网资费套餐(3G/4G上网)
柬埔寨三大运营商 Cellcard 官网套餐详情http://www.cellcard.com.kh/cellcard-internet Metfone 官网套餐详情http://www.met ...
- IT公司笔试题(一)
1. 已知一个递归算法的算法复杂度计算公式为T(n) = T(n/2) + n,则T(n)的算法复杂度为多少? 解:O(n) T(n) = T(n/2) + n = T(n/4) + n/2 + n ...
- LeetCode(三)
最长不重复子串 public class Solution { public int lengthOfLongestSubstring(String s) { if(s==null || s.leng ...
- hihoCode 1078 : 线段树的区间修改
#1078 : 线段树的区间修改 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 对于小Ho表现出的对线段树的理解,小Hi表示挺满意的,但是满意就够了么?于是小Hi将问题 ...
- Sql Server 简单查询 异步服务器更新语句
//结构:select 子句 [into 子句] from 子句 [where 子句] [group by 子句] [having 子句] [order by 子句] select dept_c ...
- 【jQuery】: 定时刷新页面
<%@page import="qflag.ucstar.seatmonitor.manager.SeatMonitorManager"%><%@ page la ...
- MSSERVER创建链接服务器
exec sp_addlinkedserver 'DB_RASS','','SQLOLEDB','127.0.0.1' ' exec sp_serveroption 'DB_RASS','rpc ou ...
- C# 基础(5)--字符串
Params 可变参数,只能修饰数组,可以传递数组,也可以传递数组的元素. 要抛弃一个异常,可以这样写: Throe new exeception?? 命名空间 不在同一个命名空间下的类,不同直接访问 ...