MyException - 我的异常网
当前位置:我的异常网» J2SE » DOM4J解析XML

DOM4J解析XML

www.MyException.Cn,网友分享于:2013-01-01   浏览:62次
DOM4J解析XML 求助
<?xml   version= "1.0 "   encoding= "utf-8 "?>
<itemlist>
<item   name= "doctype "   value= "doc   type   name "/>
<item   name= "name1 "   type= "string "   value= "value1 "/>  
<table   name= "table1 "   maxrow= "   max   row   count ">
<row   >
<item   name= "name2 "   type= "int "   value= "value21 "/>
<item   name= "name3 "   type= "float "   value= "value31 "/>
</row>
<row>
<item   name= "name2 "   type= "double "   value= "value22 "/>
<item   name= "name3 "   type= "string "   value= "value32 "/>
</row>
</table>
</itemlist>

应该如何取出对应的取值

------解决方案--------------------
http://x.discuz.net/131976/viewspace-42521.html
有个例子你参考一下吧
------解决方案--------------------
up
------解决方案--------------------
同意3楼,给的例子与你唯一不同的是需要
element.attribute( "type ")
这样将元素的属性取出来
软件开发程序错误异常ExceptionCopyright © 2009-2014MyException 版权所有