Results 1 to 1 of 1
Thread: REXML usage - accessing one item
Nov 19, 2007, 20:40 #1
- Join Date
- May 2003
- 0 Post(s)
- 0 Thread(s)
REXML usage - accessing one item
I'm reading the following XML file using REXML in rails.
The code I use my controller is this:
@events = droot.elements.to_a("//event")
@venues = droot.elements.to_a("//venue")
This works and my data is loaded into each array.
But the problem I'm having is accessing a specific venue from that array.
I've tried stuff like this, but no luck:
<%= @venues[@id=1].elements['name'] %>
Can anybody help me access one particular element in the array? In my view I end up looping through each event and just need to access the associated venue. (This is from the zvents API) Thanks for any help!