由网友(负了天下,暖你年华)分享简介:我的XML文件,该文件是这样的:I have the XML file which is like this:http://www.someurl.com/documentSetting/members/0/701/66/videos/521/521...
我的XML文件,该文件是这样的:
I have the XML file which is like this:
<activities>
<activity>
<filename>http://www.someurl.com/documentSetting/members/0/701/66/videos/521/521.mp4</filename>
<thumbnail>https://p.xsw88.cn/allimgs/daicuo/20230904/7860.png.jpg</thumbnail>
<id>521</id>
<is_private>0</is_private>
<comments>
<comment>
<id>111</id>
<body>Good video</body>
<member_id>oo7</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
<comment>
<id>222</id>
<body>nice video</body>
<member_id>123</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
<comment>
<id>333</id>
<body>gotcha!!!</body>
<member_id>11</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
</activity>
<activity>
<filename>http://www.someurl.com/documentSetting/members/0/701/66/videos/521/521.mp4</filename>
<thumbnail>https://p.xsw88.cn/allimgs/daicuo/20230904/7860.png.jpg</thumbnail>
<id>522</id>
<is_private>0</is_private>
<comments>
<comment>
<id>101</id>
<body>aaa</body>
<member_id>oo7</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
<comment>
<id>222</id>
<body>bbb</body>
<member_id>123</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
<comment>
<id>333</id>
<body>ccc</body>
<member_id>11</member_id>
<profile_image>https://p.xsw88.cn/allimgs/daicuo/20230904/7861.png</profile_image>
</comment>
</activity>
现在我要分析此XML文件并显示它像这样ListView中:::
Now i want to parse this XML file and Display it like this in ListView :::
考虑文件名标记作为状态::
Consider filename tag as Status ::
状态1:
Comment 1
Comment 2
Comment 3
Comment 4
状态2:
Comment 1
Comment 2
Comment 3
假设第一个活动有4个注释为嵌套的标签和次活动在他的注释标签的3注释。
Suppose the first activity has 4 comment as a nested tag and second activity has the 3 comment in his comment tag.
如何做到这一点?
推荐答案
尝试使用它是由机器人提供的SAX解析器。
Try using SAX Parser which is provided by Android.
下面是一个很好的例如 使用SAX解析器方法如何ü可以解析的XML文件。
Here's a good example how can u parse an XML file using SAX Parser method.
相关推荐
最新文章