X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FTwitter%2FStatus.hs;h=59b98761fce86d62ed6fdaab46d8c950c19fb174;hp=a2e6255f98990e31890beaec1ba4184459da3a60;hb=27c6a7e62a428ceb1d2a60d456b075feee196da9;hpb=5f1220bd5d1b6893a4e2c0a179b3244a12eae6c8 diff --git a/src/Twitter/Status.hs b/src/Twitter/Status.hs index a2e6255..59b9876 100644 --- a/src/Twitter/Status.hs +++ b/src/Twitter/Status.hs @@ -55,6 +55,19 @@ status_from_content content = first_user = user_from_content (users !! 0) +-- |Takes an XML String as an argument, and returns the +-- status that was parsed from it. Should only be used +-- on XML string where a is a top-level element. +parse_status :: String -> [Status] +parse_status xml_data = + catMaybes maybe_status + where + (Document _ _ root _) = xmlParse xml_file_name xml_data + root_elem = CElem root + status_element = (single_status root_elem) + maybe_status = map status_from_content status_element + + -- |Takes an XML String as an argument, and returns the list of -- statuses that can be parsed from it. parse_statuses :: String -> [Status]