dom4j读取xml

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class Test {

	public static void main(String[] args) throws Exception {
		Document doc = new SAXReader().read(Thread.currentThread().getContextClassLoader().getResourceAsStream(
				"test.xml"));
		Element elt = (Element) doc.selectObject("/config/db-info/driver-name");
		System.out.println(elt.getStringValue());
	}

}

你可能感兴趣的:(java,thread,xml)