1 -- | GameInfo represents a collection of DTDs that we don't really
2 -- handle but want to make available. The raw XML gets stored in the
3 -- database along with the XML_File_ID, but we don't parse any of it.
5 -- See also: TSN.XML.SportInfo
7 module TSN.XML.GameInfo (
12 import Data.Time.Clock ( UTCTime )
13 import Text.XML.HXT.Core ( XmlTree )
14 import Text.XML.HXT.DOM.ShowXml ( xshow )
19 parse_xml_time_stamp )
21 -- | The DTDs for everything that we consider "Game Info."
23 -- TODO: This is the list from the old implementation. We need to
24 -- make sure that we are really receiving XML for these DTDs
25 -- (i.e. the names are correct).
29 [ "CBASK_Lineup_XML.dtd",
30 "cbaskpreviewxml.dtd",
32 "Matchup_NBA_NHL_XML.dtd",
34 "MLB_Gaming_Matchup_XML.dtd",
37 "MLB_Matchup_XML.dtd",
38 "MLS_Preview_XML.dtd",
39 "NBA_Gaming_Matchup_XML.dtd",
41 "NBA_Playoff_Matchup_XML.dtd",
44 "NCAA_FB_Preview_XML.dtd",
46 "NFL_NCAA_FB_Matchup_XML.dtd",
49 "WorldBaseballPreviewXML.dtd" ]
52 -- | The data structure that holds the XML representation of a
59 time_stamp :: UTCTime,
64 from_xml :: String -> XmlTree -> Either String Message
65 from_xml dtdname xmltree = do
66 xmlfid <- parse_xmlfid xmltree
67 timestamp <- parse_xml_time_stamp xmltree
68 message <- parse_message xmltree
69 return $ Message dtdname (fromInteger xmlfid) timestamp (xshow [message])