REXML Troubleshooting - accessing one item
Posted on 2007-11-20
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!