I’ve been trying to use XmlResourceParser but I don’t feel it’s the right tool for the job. I have a set of items that have subitems and I want to pull a specific item out, such as the second item in this list:
<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>
I’d like to be able to pull them by “id” number in short, WITHOUT having to set up my own objects. If possible.
You can use this code :