Dom4j解析复杂xml获取想要的内容

一只开发狗001 一只开发狗001 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
先上xml如下

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="" xmlns="" xmlns:d="" xmlns:m="">
<id></id>
<title type="text">Users</title>
<updated>2019-12-11T02:28:30Z</updated>
<link rel="self" title="Users" href="Users"/>
<entry>
<id>(1L)</id>
<category term="" scheme=""/>
<link rel="edit" title="User" href="Users(1L)"/>
<link rel="" type="application/atom+xml;type=feed" title="Sessions" href="Users(1L)/Sessions"/>
<title/>
<updated>2019-12-11T02:28:30Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int64">1</d:Id>
<d:Sid>S-1-5-7</d:Sid>
<d:Upn></d:Upn>
<d:UserName>ANONYMOUS LOGON</d:UserName>
<d:FullName></d:FullName>
<d:Domain></d:Domain>
<d:CreatedDate m:type="Edm.DateTime">2019-11-20T05:01:43.2</d:CreatedDate>
<d:ModifiedDate m:type="Edm.DateTime">2019-11-20T05:01:43.2</d:ModifiedDate>
</m:properties>
</content>
</entry>
<entry>
<id></id>
<category term="" scheme=""/>
<link rel="edit" title="User" href="Users(2L)"/>
<link rel="" type="application/atom+xml;type=feed" title="Sessions" href="Users(2L)/Sessions"/>
<title/>
<updated>2019-12-11T02:28:30Z</updated>
<author>
<name/>
</author>
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int64">2</d:Id>
<d:Sid>S-1-5-21-916077177-3160758025-4246751474-1106</d:Sid>
<d:Upn>text01@text.com</d:Upn>
<d:UserName>text01</d:UserName>
<d:FullName>textt01</d:FullName>
<d:Domain>LINGHANG</d:Domain>
<d:CreatedDate m:type="Edm.DateTime">2019-11-21T05:49:47.823</d:CreatedDate>
<d:ModifiedDate m:type="Edm.DateTime">2019-12-02T04:55:24.29</d:ModifiedDate>
</m:properties>
</content>
</entry>
</feed>

xml中有多个entry节点需要遍历,遍历后如何得到其子节点中d:的属性值,遍历没啥问题,但是遍历后寻找这个节点下的子节点就出了问题,老是显示获取的内容为空,求大神指教,指向获得这些属性值将其变为List<Map>,谢谢
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
一只开发狗001
Java SE 62,621 成员 307,251 内容