i´m using feedzirra to fetch and parse a document with the following structure:
<item>
<title>Title</title>
<description>Ddescription</description>
<date>2014-02-01 20:00:00</date>
<durationMinutes>40</durationMinutes>
<sessionGuid>f09c385khll5-5edc-4c8a-8370-1027ac7cb2ce</sessionGuid>
<eventGuid>1d53fac2-a553-46b2-a72323s</eventGuid>
<sessionID>782235</sessionID>
</item>
When looping through the entries, entry.title and entry.description give me access to those elements, but i cannot get the rest.
This is the code for fetching and parsing:
feed = Feedzirra::Feed.fetch_and_parse("http://localhost/sessionallrss-21Dec.xml")
feed.entries.each do |entry|
unless exists? Event.find_by_guid(:guid)
event = Event.new
event.title = entry.title
event.description = entry.description
event.sessionGuid = entry.sessionGuid
event.durationMinutes = entry.durationMinutes
event.save
end
end
How do i get the value for custom named elements like "durationMinutes" or "sessionGuid"?
Have you tried inspecting the entry object to see if it has the attributes by different names? (puts entry.inspect)
If the elements/attributes are missing from the inspection, you can add them into the parser like so:
References: