/**
1. jdom.jar
读取xml配置文件
代码如下
**/
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public static void init() throws JDOMException, IOException{
SAXBuilder parser = new SAXBuilder();
Document docConfig = parser.build("config.xml");
Element elConfig = docConfig.getRootElement();
String host = elConfig.getChildText("hostNumber");
System.out.println(host);
}