2
我是新来的编码,并试图了解Android的XMLPullParser如何浏览给定的XML。下面是一个XML示例,其中我只对拉取Child 1中的属性信息感兴趣。使用Android XMLPullParser导航/解析XML
如何告诉Android XMLPullParser只关注特定标记(子级1)内的信息,而忽略其他标记包含类似的数据?
例子:
<root>
<child 1>
<child 1.1>
<attribute 1></attribute 1>
<attribute 2></attribute 2>
</child 1.1>
<child 1.2>
<attribute 1></attribute 1>
<attribute 2></attribute 2>
</child 1.2>
</child 1>
<child 2>
<child 2.1>
<attribute 1></attribute 1>
<attribute 2></attribute 2>
</child 2.1>
<child 2.2>
<attribute 1></attribute 1>
<attribute 2></attribute 2>
</child 2.2>
</child 2>
</root>
谢谢!
教程尝试:
- 的http:// developer.android.com/training/basics/network-ops/xml.html
- 的http:// theopentutorials.com/tutorials/android/xml/android-simple-xmlpullparser-tutorial/
拉解析已知很难编码,特别是xml的结构很复杂......你打开其他apis吗? –
对任何其他人开放。我的最终目标是将分析的数据呈现在包含在片段中的列表视图中。 – DC5Gator
你能澄清你想输出的样子吗? –