ㄓㄤㄑㄧㄤ

dom4j怎么获得指定名称的节点信息

<?xml version="1.0" encoding="utf-8" ?> 
 <MgUtil>
    <db_config>
        <db_driver>oracle.jdbc.driver.OracleDriver</db_driver>
        <db_url>dbc:oracle:thin:@172.16.1.101:1521:orcl</db_url>
        <db_user>zdyn</db_user>
        <db_password>zdyn</db_password>
    </db_config>
    <relationFactory>
        <classInfo></classInfo>
    </relationFactory>
 </MgUtil>
String xml ="...";
Document doc = DocumentHelper.parseText(xml);
Element root = doc.getRootElement();
Element db_config = root.element("db_config");
Element db_driver = db_config.element("db_driver");
String val_db_driver= db_driver.getTextTrim();

 

posted @ 2014-12-12 10:43  ㄓㄤㄑㄧㄤ  阅读(10886)  评论(0编辑  收藏  举报
哈哈,页脚部分。