【发布时间】:2012-05-29 17:30:15
【问题描述】:
我一直在尝试使用 XmlResourceParser,但我不认为它是适合这项工作的工具。我有一组包含子项的项,我想提取一个特定项,例如此列表中的第二项:
<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>
简而言之,我希望能够通过“id”数字拉取它们,而不必设置我自己的对象。如果可能的话。
【问题讨论】: