java解析相同子节点但不同节点名称的xml

LiuzjorHz 2014-03-17 11:20:25
<?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? 不能按照顺序来进行解析,因为有些子节点可能不存在
...全文
340 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
跳蚤图 2014-03-27
  • 打赏
  • 举报
回复
这个xml没有什么特殊的地方啊。 直接解析就可以

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧