首页 > 代码库 > Dom4J解析Xml

Dom4J解析Xml

https://eztv.ag/ezrss.xml

举例

<item>
<title>Quantico S02E04 720p HDTV X264-DIMENSION</title>
<category>TV</category>
<link>
https://eztv.ag/ep/160402/quantico-s02e04-720p-hdtv-x264-dimension/
</link>
<guid>
https://eztv.ag/ep/160402/quantico-s02e04-720p-hdtv-x264-dimension/
</guid>
<pubDate>Sun, 23 Oct 2016 20:18:02 -0400</pubDate>
<torrent:contentLength>1008582498</torrent:contentLength>
<torrent:infoHash>91A3412B201F44F61A5E5526E4D01C68C79CDBA1</torrent:infoHash>
<torrent:magnetURI>
<![CDATA[
magnet:?xt=urn:btih:91A3412B201F44F61A5E5526E4D01C68C79CDBA1&dn=Quantico.S02E04.720p.HDTV.X264-DIMENSION%5Beztv%5D.mkv&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969
]]>
</torrent:magnetURI>
<torrent:seeds>0</torrent:seeds>
<torrent:peers>0</torrent:peers>
<torrent:verified>0</torrent:verified>
<torrent:fileName>Quantico.S02E04.720p.HDTV.X264-DIMENSION[eztv].mkv</torrent:fileName>
<enclosure url="https://zoink.ch/torrent/Quantico.S02E04.720p.HDTV.X264-DIMENSION[eztv].mkv.torrent" length="1008582498" type="application/x-bittorrent"/>
</item>

 

这里item的子元素在dom4j里面

作为子元素选择器 item.element(String name)

torrent:seeds

这一段要被选中,要忽略torrent信息,这应该是XML规范的一种,torrent只是作为一个集合标记

Element.element("seeds")

 

Dom4J解析Xml