]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/Twitter/Status.hs
Add the ability to twat a single status (as a debugging tool).
[dead/halcyon.git] / src / Twitter / Status.hs
index a2e6255f98990e31890beaec1ba4184459da3a60..59b98761fce86d62ed6fdaab46d8c950c19fb174 100644 (file)
@@ -55,6 +55,19 @@ status_from_content content =
       first_user = user_from_content (users !! 0)
 
 
       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 <status> 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]
 -- |Takes an XML String as an argument, and returns the list of
 -- statuses that can be parsed from it.
 parse_statuses :: String -> [Status]