+ entries = :xmerl_xpath.string('//entry', doc)
+
+ activities = Enum.map(entries, fn (entry) ->
+ {:xmlObj, :string, object_type } = :xmerl_xpath.string('string(/entry/activity:object-type[1])', entry)
+ {:xmlObj, :string, verb } = :xmerl_xpath.string('string(/entry/activity:verb[1])', entry)
+
+ case verb do
+ 'http://activitystrea.ms/schema/1.0/share' ->
+ with {:ok, activity, retweeted_activity} <- handle_share(entry, doc), do: [activity, retweeted_activity]
+ _ ->
+ case object_type do
+ 'http://activitystrea.ms/schema/1.0/note' ->
+ with {:ok, activity} <- handle_note(entry, doc), do: activity
+ 'http://activitystrea.ms/schema/1.0/comment' ->
+ with {:ok, activity} <- handle_note(entry, doc), do: activity
+ _ ->
+ Logger.error("Couldn't parse incoming document")
+ nil
+ end
+ end
+ end)
+ {:ok, activities}
+ end