I am working from an example provided by my professor which gets data from a weather forecast site and parses the XML file to show the weather conditions in a list. My program is similar, but I want to retrieve information that is nested within several nodes, and I don't know how to get to it. Here is the XML file I'm working from:
<?xml version="1.0" encoding="UTF-8"?>
<DirectionsResponse>
<status>OK</status>
<route>
<summary>S Street Viaduct</summary>
<leg>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>40.7021400</lat>
<lng>-74.0158200</lng>
</start_location>
<end_location>
<lat>40.7021400</lat>
<lng>-74.0158200</lng>
</end_location>
<polyline>
<points>kslwFzewbM</points>
<levels>B</levels>
</polyline>
<duration>
<value>0</value>
<text>1 min</text>
</duration>
<html_instructions>Head <b>east</b> on <b>S Street Viaduct</b></html_instructions>
<distance>
<value>0</value>
<text>1 ft</text>
</distance>
</step>
<duration>
<value>0</value>
<text>1 min</text>
</duration>
<distance>
<value>0</value>
<text>1 ft</text>
</distance>
<start_location>
<lat>40.7021400</lat>
<lng>-74.0158200</lng>
</start_location>
<end_location>
<lat>40.7021400</lat>
<lng>-74.0158200</lng>
</end_location>
<start_address>S Street Viaduct, New York, NY 10004, USA</start_address>
<end_address>S Street Viaduct, New York, NY 10004, USA</end_address>
</leg>
<copyrights>Map data ©2010 Google, Sanborn</copyrights>
<overview_polyline>
<points>kslwFzewbM</points>
<levels>B</levels>
</overview_polyline>
</route>
</DirectionsResponse>
I'm really only interested in retrieving the info in the "html_instructions" tag, but it is nested in the "route", "leg", and "step" tags. I have seen several tutorials and questions on SO about parsing XML but couldn't seem to find a solution to this. Any direction would be greatly appreciated!
Thanks.