java解析相同子节点但不同节点名称的xml
<?xml version="1.0" encoding="utf-8"?>
<response status="SUCCESS">
<EnraAttributes>
<time>A</time>
<test>
<sample rank="0">
<id>100</id>
<attribute name=”name1”>xxx</attribute>
<attribute name=”sex”>1</attribute>
<attribute name=”age”>20</attribute>
</sample>
</test>
<test>
<sample rank="0">
<id>100</id>
<attribute name=”name2”>xxx</attribute>
<attribute name=”sex”>0</attribute>
<attribute name=”age”>30</attribute>
</sample>
</test>
</EnraAttributes>
</response>
谁知道怎么解析这个格式的xml? 不能按照顺序来进行解析,因为有些子节点可能不存在