You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在循环中按日期对XML数据进行排序

寻求XML处理适配方案

我一早上查阅了大量相关问答,但始终没找到能和我的代码适配的解决方案。我手头的XML文件格式如下:

<?xml version="1.0" encoding="UTF-8"?> 
<images> 
<image> 
<src>belly_button_1.jpg</src> 
<title>Belly Button</title> 
<desc>Belly button piercing using 14G curved barbell.</desc> 
<instagram>https://www.example.com/p/BbHba1BgmrC/</instagram> 
<date>November 5, 2017</date> 
</image> 
<image> 
<src>christina_1.jpg</src> 
<title>Christina(Pubic)</title> 
<desc>Christina(pubic) piercing using 14G curved barbell.</desc> 
<instagram>https://www.example.com/p/BclajtRgkPk/</instagram> 
<date>December 11, 2017</date> 
</image> 
<image> 
<src>christina_2.jpg</src> 
<title>Christina(Pubic)</title> 
<desc>Christina(pubic) piercing using 14G curved barbell.</desc> 
<instagram>https://www.example.com/p/BdSlWkogshq/</instagram> 
<date>December 29, 2017</date> 
</image> 
<image> 
<src>eyebrow_1.jpg</src> 
<title>Eyebrow</title> 
<desc>Vertical eyebrow piercing using 16G curved barbell.</desc> 
<instagram>https://www.example.com/p/BbIBtHDAX2F/</instagram> 
<date>November 5, 2017</date> 
</image> 
<image> 
<src>eyebrow_2.jpg</src> 
<title>Eyebrow</title> 
<desc>Vertical eyebrow piercing using 16G curved barbell.</desc> 
<instagram>https://www.example.com/p/Bfi9x_RAczq/</instagram> 
<date>February 23, 2018</date> 
</image> 
<image> 
<src>lobe_1.jpg</src> 
<title>Ear Lobe</title> 
<desc>Ear lobe piercing using 16G straight barbell.</desc> 
<instagram>https://www.example.com/p/BbHxZLtAnVA/</instagram> 
<date>November 5, 2017</date> 
</image> 
<image> 
<src>lobes_1.jpg</src> 
<title>Ear Lobe(Pair)</title> 
<desc>Ear lobe piercings using 14G captive bead rings.</desc> 
<instagram>https://www.example.com/p/Bb4zQO1gsAO/</instagram> 
<date>November 24, 2017</date> 
</image> 
<image> 
<src>lobes_2.jpg</src> 
<title>Ear Lobe(Pair)</title> 
<desc>Ear lobe piercings using 14G captive bead rings.</desc> 
<instagram>https://www.example.com/p/BdSlqmXggSt/</instagram> 
<date>December 29, 2017</date> 
</image> 
<image> 
<src>monroe_1.jpg</src> 
<title>Monroe</title> 
<desc>Monroe piercing using 16G lip stud.</desc> 
<instagram>https://www.example.com/p/BbHxJwYA3lt/</instagram> 
<date>November 5, 2017</date> 
</image> 
<image> 
<src>monroe_2.jpg</src> 
<title>Monroe</title> 
<desc>Monroe piercing using 16G internally threaded lip stud.</desc> 
<instagram>https://www.example.com/p/BifXeMYFjfO/</instagram> 
<date>May 7, 2018</date> 
</image> 
<image> 
<src>nipples_1.jpg</src> 
<title>Nipples(Female Pair)</title> 
<desc>Nipple piercings using 14G straight barbell.</desc> 
<instagram>https://www.example.com/p/Bcl7eSoAuaa/</instagram> 
<date>December 12, 2017</date> 
</image> 
<image> 
<src>nipples_2.jpg</src> 
<title>Nipples(Female Pair)</title> 
<desc>Nipple piercings using 14G straight barbell.</desc> 
<instagram>https://www.example.com/p/BdSlP5iATaj/</instagram> 
<date>December 29, 2017</date> 
</image> 
<image> 
<src>nostril_1.jpg</src> 
<title>Nostril</title> 
<desc>Nostril piercing using 20G nose stud.</desc> 
<instagram>https://www.example.com/p/BbHbK6gg8Ub/</instagram> 
<date>November 5, 2017</date> 
</image> 
<image> 
<src>nostril_2.jpg</src> 
<title>Nostril</title> 
<desc>Nostril piercing using 18G nose stud.</desc> 
<instagram>https://www.example.com/p/BifWlv7FsMK/</instagram> 
<date>May 7, 2018</date> 
</image> 
<image> 
<src>septum_1.jpg</src> 
<title>Septum</title> 
<desc>Septum piercing using 16G horeshoe barbell.</desc> 
<instagram>https://www.example.com/p/Bb_QglhAYIA/</instagram> 
<date>November 27, 2018</date> 
</image> 
<image> 
<src>septum_2.jpg</src> 
<title>Septum</title> 
<desc>Septum piercing using 16G horeshoe barbell.</desc> 
<instagram>https://www.example.com/p/BcDzH46AG6W/</instagram> 
<date>November 28, 2018</date> 
</image> 
<l

内容的提问来源于stack exchange,提问作者Jesse Elser

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:36:50