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
你能澄清你想輸出的樣子嗎? –