在一个xml文件中,如何列出所有不重复ID列表,并且统计出其出现的个数,请看具体的帖子内容.
test.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<Data>
<topic_id>001</topic_id>
<systime>2006-02-02</systime>
<topic_id>002</topic_id>
<systime>2006-02-23</systime>
<topic_id>001</topic_id>
<systime>2006-02-12</systime>
<topic_id>003</topic_id>
<systime>2006-02-12</systime>
<topic_id>002</topic_id>
<systime>2006-02-12</systime>
</Data>
针对上面的数据,我要得到返回的是两个字符串:
"001|002|003" //出现的所有不重复的topic_id的列表,以"|"分隔
"2|2|1" //这个字符串是与上面的字符串相对应,显示每个topic_id出现的个数,以"|"分隔
请问这个方法如何来写?