首页 > 代码库 > dom4j怎么获得指定名称的节点信息

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();

 

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