我一直在嘗試使用XmlResourceParser,但我不覺得它是正確的工具。我有一組具有子項目的項目,我想拉出一個具體項目,如在此列表中的第二項:在Android應用程序中使用Java獲取特定的XML標記文本
<story>
<id>1</id>
<name>The First Room</name>
<description>You aren't sure how you ended up here, but there is nothing in this room of interest. You should probably escape.</description>
<direction>
<name>North</name>
<id>2</id>
</direction>
<direction>
<name>East</name>
<id>3</id>
</direction>
</story>
<story>
<id>2</id>
<name>Moldy Room</name>
<description>This room is filled with mold. It would be hazardous to your heath to stick around here.</description>
<direction>
<name>South</name>
<id>1</id>
</direction>
<direction>
<name>West</name>
<id>4</id>
</direction>
</story>
我希望能夠通過「身份證」號碼拉他們總之,無需設置我自己的對象。如果可能的話。
你看我的答案? – AliSh