【发布时间】:2012-10-05 01:13:18
【问题描述】:
如何使用dom parser java解析xml中的同名标签?
我有以下 xml 文件,我想使用 java 中的 dom 解析器进行解析。
<?xml version="1.0"?>
<GameWorld>
<player>
<playerID>1</playerID>
<inventory>
<item>cards</item>
<item>notes</item>
<item>dice</item>
</inventory>
<position>50 50 10 60</position>
<room>offices</room>
</player>
<player>
<playerID>2</playerID>
<inventory>
<item>notes</item>
<item>dice</item>
<item>cards</item>
</inventory>
<position>10 10 10</position>
<room>security room</room>
</player>
</GameWorld>
【问题讨论】: