import module namespace http = "http://www.zorba-xquery.com/modules/http-client"; import module namespace s = "http://www.zorba-xquery.com/modules/string"; import module namespace json = "http://www.zorba-xquery.com/modules/converters/json"; declare namespace h = "http://expath.org/ns/http-client"; declare namespace a = "http://www.zorba-xquery.com/annotations"; declare namespace kml = "http://www.opengis.net/kml/2.2"; let $items := http:send-request( , "https://stream.twitter.com/1/statuses/sample.json", () )[2] let $tweets := s:split($items, " ") for $tweet at $i in $tweets let $json := $tweet let $tweet := try { let $tweet := json:parse($json) return json:serialize($tweet) } catch * { error(xs:QName('local:ERROR'), trace($json, "json")) } return concat($tweet , " ")